<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:viewmodel="clr-namespace:AIStudio.Wpf.DiagramDesigner.Additionals.Extensions.ViewModels" 
                    xmlns:gif="http://wpfanimatedgif.codeplex.com" 
                    xmlns:controls="clr-namespace:AIStudio.Wpf.DiagramDesigner.Additionals.Controls"
                    xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
                    xmlns:Fluent="urn:fluent-ribbon"
                    xmlns:i="http://schemas.microsoft.com/xaml/behaviors">

    <dd:BoolVisibilityConverter x:Key="BoolVisibilityConverter"/>
    <dd:DoubleToThickness x:Key="DoubleToThickness"/>
    <dd:ColorBrushConverter x:Key="ColorBrushConverter"/>
   
    <DataTemplate DataType="{x:Type viewmodel:OutLineTextDesignerItemViewModel}">
        <Viewbox Stretch="Fill" IsHitTestVisible="False">
            <controls:OutlineText StrokePosition="Outside"
                         Text="{Binding Text}"
                         FontSize="{Binding FontViewModel.FontSize}" 
                         FontFamily="{Binding FontViewModel.FontFamily}"  
                         FontWeight="{Binding FontViewModel.FontWeight}"
                         FontStyle="{Binding FontViewModel.FontStyle}"                         
                         FontStretch="{Binding FontViewModel.FontStretch}"
                         TextDecorations="{Binding FontViewModel.TextDecorations}"
                         Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" 
                         StrokeThickness="{Binding ColorViewModel.LineWidth}"
                         Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"/>
        </Viewbox>
    </DataTemplate>

    <!-- DataTemplate for Popup look and feel -->
    <DataTemplate DataType="{x:Type viewmodel:OutLineTextDesignerItemData}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Label Grid.Row="0"
                   Content="添加文本"
                   Margin="5" />
            <TextBox Grid.Row="1"
                    Text="{Binding Text}"
                    FontSize="{Binding ElementName=comboBoxFontSize,Path=SelectedItem}" 
                    FontFamily="{Binding ElementName=comboBoxFontName,Path=SelectedItem}"  
                    FontWeight="{Binding ElementName=buttonBold,Path=IsChecked,Converter={dd:ConverterBoolToValueMap Parameter='Regular'}, ConverterParameter='Bold'}"
                    FontStyle="{Binding ElementName=buttonItalic,Path=IsChecked,Converter={dd:ConverterBoolToValueMap Parameter='Normal'}, ConverterParameter='Italic'}"  
                    TextDecorations="{Binding ElementName=buttonUnderline,Path=IsChecked,Converter={dd:ConverterBoolToValueMap Parameter='None'}, ConverterParameter='Underline'}"
                     Height="100"
                    Margin="5" 
                    TextWrapping="Wrap"/>

            <StackPanel Grid.Row="2" Orientation="Horizontal">
                <Fluent:ComboBox x:Name="comboBoxFontName"
                                         Margin="5"
                                         MinWidth="49"
                                         Height="22"
                                         BorderBrush="Gainsboro"
                                         IsTextSearchEnabled="True"
                                         ResizeMode="Vertical"
                                         KeyTip="FF"
                                         SizeDefinition="Small"
                                         ScrollViewer.CanContentScroll="False"
                                         ItemsSource="{x:Static dd:FontViewModel.FontFamilys}"
                                         SelectedItem="{Binding FontViewModel.FontFamily}">
                    <Fluent:ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}"
                                           FontFamily="{Binding}" />
                        </DataTemplate>
                    </Fluent:ComboBox.ItemTemplate>
                </Fluent:ComboBox>
                <Fluent:ComboBox x:Name="comboBoxFontSize"
                                         Margin="5"
                                         Width="49"
                                         HorizontalAlignment="Left"
                                         Height="22"
                                         BorderBrush="Gainsboro"
                                         IsEditable="True"
                                         SizeDefinition="Small"
                                         ResizeMode="Vertical"
                                         KeyTip="FS"
                                         ItemsSource="{x:Static dd:FontViewModel.FontSizes}"
                                         SelectedItem="{Binding FontViewModel.FontSize}">
                    <Fluent:ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding}"/>
                        </DataTemplate>
                    </Fluent:ComboBox.ItemTemplate>
                </Fluent:ComboBox>
                <Fluent:ToggleButton KeyTip="B"
                                             x:Name="buttonBold"
                                             Icon="pack://application:,,,/AIStudio.Wpf.DiagramDesigner.Additionals;component/Images/Bold.png"
                                             HorizontalAlignment="Left"
                                             SizeDefinition="Small" 
                                             IsChecked="{Binding FontViewModel.FontWeight,Converter={dd:ConverterValueMapToBool Parameter='Regular'}, ConverterParameter='Bold'}"/>
                <Fluent:ToggleButton x:Name="buttonItalic"
                                             KeyTip="I"
                                             Icon="pack://application:,,,/AIStudio.Wpf.DiagramDesigner.Additionals;component/Images/Italic.png"
                                             HorizontalAlignment="Left"
                                             SizeDefinition="Small" 
                                             IsChecked="{Binding FontViewModel.FontStyle,Converter={dd:ConverterValueMapToBool Parameter='Normal'}, ConverterParameter='Italic'}"/>
                <Fluent:ToggleButton x:Name="buttonUnderline"
                                             KeyTip="U"
                                             Icon="pack://application:,,,/AIStudio.Wpf.DiagramDesigner.Additionals;component/Images/Underline.png"
                                             HorizontalAlignment="Left"
                                             SizeDefinition="Small" 
                                             IsChecked="{Binding FontViewModel.Underline}"/>
            </StackPanel>
        </Grid>
    </DataTemplate>
</ResourceDictionary>