maui-linux/Xamarin.Forms.Platform.WPF/Themes/FormsContentDialog.xaml

105 строки
6.0 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:controls="clr-namespace:Xamarin.Forms.Platform.WPF.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Xamarin.Forms.Platform.WPF;component/Assets/Converters.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="TitleDefaultTemplate" >
<TextBlock DataContext="{Binding}"
Text="{Binding}"
FontFamily="Segoe UI"
FontSize="26"
TextOptions.TextFormattingMode="Ideal"
TextWrapping="WrapWithOverflow"
Foreground="Black"/>
</DataTemplate>
<Style TargetType="controls:FormsContentDialog">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Width" Value="500" />
<Setter Property="Height" Value="Auto" />
<Setter Property="TitleTemplate" Value="{StaticResource TitleDefaultTemplate}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:FormsContentDialog">
<Border BorderBrush="{DynamicResource AccentColor}" Background="#FFF2F2F2" BorderThickness="2">
<Grid Margin="24">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" MinHeight="150" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- title -->
<ContentControl x:Name="Title"
Content="{TemplateBinding Title}"
ContentTemplate="{TemplateBinding TitleTemplate}"
IsTabStop="False">
</ContentControl>
<!-- content -->
<ContentPresenter x:Name="Content" Margin="0,20"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Grid.Row="1" >
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type System:String}" >
<TextBlock Text="{Binding}"
FontFamily="Segoe UI"
FontSize="16"
TextOptions.TextFormattingMode="Ideal"
TextWrapping="Wrap"
Foreground="Black"/>
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
<!-- buttons -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="PART_PrimaryButton" Content="{TemplateBinding PrimaryButtonText}"
Height="50"
MinWidth="140"
Margin="4,0,0,0"
BorderBrush="Transparent"
Command="{x:Static controls:FormsContentDialog.PrimaryButtonRoutedCommand}">
</Button>
<Button x:Name="PART_SecondaryButton" Content="{TemplateBinding SecondaryButtonText}"
Height="50"
MinWidth="140"
Margin="4,0,0,0"
BorderBrush="Transparent"
Command="{x:Static controls:FormsContentDialog.SecondaryButtonRoutedCommand}"/>
</StackPanel>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPrimaryButtonEnabled" Value="false">
<Setter TargetName="PART_PrimaryButton" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="PrimaryButtonText" Value="{x:Static System:String.Empty}">
<Setter TargetName="PART_PrimaryButton" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="PrimaryButtonText" Value="{x:Null}">
<Setter TargetName="PART_PrimaryButton" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsSecondaryButtonEnabled" Value="false">
<Setter TargetName="PART_SecondaryButton" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="SecondaryButtonText" Value="{x:Static System:String.Empty}">
<Setter TargetName="PART_SecondaryButton" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="SecondaryButtonText" Value="{x:Null}">
<Setter TargetName="PART_SecondaryButton" Property="Visibility" Value="Collapsed" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>