Files
ZuneModdingHelper/OwlCore.Wpf/AbstractUI/Themes/AbstractMultiChoiceUIElementStyle.xaml
T

79 lines
4.3 KiB
XML
Raw Normal View History

2021-08-05 20:45:26 -05:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="OwlCore.Wpf.AbstractUI.Themes.AbstractMultiChoiceUIElementStyle"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
2024-03-12 17:06:06 -05:00
xmlns:abstractUI="clr-namespace:OwlCore.AbstractUI.ViewModels;assembly=OwlCore.AbstractUI"
2021-08-05 20:45:26 -05:00
xmlns:convertvis="clr-namespace:OwlCore.Wpf.Converters.Bools.Visible"
xmlns:controls="clr-namespace:OwlCore.Wpf.AbstractUI.Controls"
xmlns:themes="clr-namespace:OwlCore.Wpf.AbstractUI.Themes">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/OwlCore.Wpf;component/AbstractUI/Themes/AbstractUIResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="DefaultAbstractMultipleChoiceComboBoxTemplate" DataType="abstractUI:AbstractMultiChoiceUIElementViewModel">
<ComboBox ItemsSource="{Binding Items}" SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="abstractUI:AbstractMultiChoiceItemViewModel">
<TextBlock Text="{Binding Title}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="SelectionChanged">
<behaviors:InvokeCommandAction Command="{Binding ItemSelectedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</ComboBox>
</DataTemplate>
<DataTemplate x:Key="DefaultAbstractMultipleChoiceRadioButtonTemplate" DataType="abstractUI:AbstractMultiChoiceUIElementViewModel">
<ItemsControl ItemsSource="{Binding Items}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="abstractUI:AbstractMultiChoiceItemViewModel">
<RadioButton Command="{Binding ItemSelectedCommand}" Content="{Binding Title}" GroupName="{Binding GroupId}" IsChecked="{Binding IsSelected, Mode=TwoWay}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="DefaultAbstractMultipleChoiceTemplate" DataType="abstractUI:AbstractMultiChoiceUIElementViewModel">
<StackPanel>
<TextBlock Text="{Binding Title}" FontSize="{StaticResource DefaultAbstractUITitleFontSize}" ToolTipService.ToolTip="{Binding TooltipText}" />
<TextBlock Text="{Binding Subtitle}" FontSize="{StaticResource DefaultAbstractUISubtitleFontSize}"
FontWeight="{StaticResource DefaultAbstractUISubtitleFontWeight}"
Opacity="{StaticResource DefaultAbstractUISubtitleOpacity}"
Visibility="{Binding Path=Subtitle, TargetNullValue=Collapsed}"/>
<ContentControl Content="{Binding}" Margin="0,5,0,0">
<ContentControl.ContentTemplateSelector>
<themes:AbstractMultiChoiceTypeTemplateSelector ComboBoxTemplate="{StaticResource DefaultAbstractMultipleChoiceComboBoxTemplate}"
RadioButtonTemplate="{StaticResource DefaultAbstractMultipleChoiceRadioButtonTemplate}"/>
</ContentControl.ContentTemplateSelector>
</ContentControl>
</StackPanel>
</DataTemplate>
<Style TargetType="controls:AbstractMultiChoicePresenter">
<Style.Setters>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:AbstractMultiChoicePresenter">
<ContentControl ContentTemplate="{StaticResource DefaultAbstractMultipleChoiceTemplate}"
2021-10-23 21:51:51 -05:00
Content="{Binding}"
2021-08-05 20:45:26 -05:00
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
</ResourceDictionary>