Filtration/Filtration/UserControls/ThemeComponentSelectionCont...

96 lines
6.4 KiB
XML

<UserControl x:Class="Filtration.UserControls.ThemeComponentSelectionControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:userControls="clr-namespace:Filtration.UserControls"
xmlns:themeEditor="clr-namespace:Filtration.ObjectModel.ThemeEditor;assembly=Filtration.ObjectModel"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=userControls:ThemeComponentSelectionControl}"
d:DesignHeight="50" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Filtration.Common;component/Styles/SharedResourcesDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Height="20">
<Grid.Resources>
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MetroComboBox}">
<Setter Property="MinHeight" Value="0" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0"
ItemsSource="{Binding AvailableThemeComponents}"
SelectedValue="{Binding ThemeComponent}"
Grid.IsSharedSizeScope="True"
Visibility="{Binding ShowThemeComponentComboBox, Converter={StaticResource BooleanToVisibilityConverter}}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SetBlockValueCommand, RelativeSource={RelativeSource AncestorType=userControls:BlockItemControl}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ComboBox.ItemTemplate>
<DataTemplate >
<ContentControl Content="{Binding}">
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="ComponentNameColumn" Width="Auto" />
<ColumnDefinition SharedSizeGroup="ComponentValueColumn" Width="20" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding ComponentName}" Margin="0,0,2,0" />
<ContentControl Content="{Binding Mode=OneWay}" Grid.Column="1">
<ContentControl.Resources>
<DataTemplate DataType="{x:Type themeEditor:ColorThemeComponent}">
<Border Background="{Binding Color, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
</DataTemplate>
<DataTemplate DataType="{x:Type themeEditor:IntegerThemeComponent}">
<TextBlock Text="{Binding Value}" FontWeight="Bold" />
</DataTemplate>
<DataTemplate DataType="{x:Type themeEditor:StrIntThemeComponent}">
<!--TODO: How to show theese?-->
</DataTemplate>
<DataTemplate DataType="{x:Type themeEditor:StringThemeComponent}">
<!--TODO: How to show theese?-->
</DataTemplate>
<DataTemplate DataType="{x:Type themeEditor:IconThemeComponent}">
<!--TODO: How to show theese?-->
</DataTemplate>
<DataTemplate DataType="{x:Type themeEditor:EffectColorThemeComponent}">
<!--TODO: How to show theese?-->
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<userControls:CrossButton Grid.Column="1" Height="12" Command="{Binding RemoveThemeComponentCommand}" VerticalAlignment="Top" Visibility="{Binding ShowThemeComponentComboBox, Converter={StaticResource BooleanToVisibilityConverter}}" />
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Visibility="{Binding ShowThemeComponentComboBox, Converter={StaticResource InverseBooleanVisibilityConverter}}" VerticalAlignment="Center">
<Hyperlink Command="{Binding AddThemeComponentCommand}">Add Theme Tag</Hyperlink>
</TextBlock>
</Grid>
</UserControl>