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

52 lines
3.5 KiB
XML

<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.AbstractBooleanStyle"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:abstractUI="clr-namespace:OwlCore.AbstractUI.ViewModels;assembly=OwlCore"
xmlns:convertvis="clr-namespace:OwlCore.Wpf.Converters.Bools.Visible"
xmlns:controls="clr-namespace:OwlCore.Wpf.AbstractUI.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/OwlCore.Wpf;component/AbstractUI/Themes/AbstractUIResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="DefaultAbstractBooleanTemplate" DataType="abstractUI:AbstractBooleanViewModel">
<StackPanel Margin="0,0,0,4">
<TextBlock Text="{Binding DataContext.Title, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"
FontSize="{StaticResource DefaultAbstractUITitleFontSize}"
ToolTipService.ToolTip="{Binding TooltipText, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"
Visibility="{Binding DataContext.Title, TargetNullValue=Collapsed, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}" />
<TextBlock Text="{Binding DataContext.Subtitle, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"
FontSize="{StaticResource DefaultAbstractUISubtitleFontSize}"
FontWeight="{StaticResource DefaultAbstractUISubtitleFontWeight}"
Opacity="{StaticResource DefaultAbstractUISubtitleOpacity}"
Visibility="{Binding DataContext.Subtitle, TargetNullValue=Collapsed, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"/>
<CheckBox ToolTipService.ToolTip="{Binding DataContext.TooltipText, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"
Content="{Binding DataContext.Label, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}"
IsChecked="{Binding DataContext.IsToggled, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Checked">
<behaviors:InvokeCommandAction Command="{Binding DataContext.ToggledCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl}}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</CheckBox>
</StackPanel>
</DataTemplate>
<Style TargetType="controls:AbstractBooleanPresenter">
<Style.Setters>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:AbstractBooleanPresenter">
<ContentControl ContentTemplate="{StaticResource DefaultAbstractBooleanTemplate}"
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
</ResourceDictionary>