generated from unoplatform/template
-
Notifications
You must be signed in to change notification settings - Fork 27
/
ControlExample.xaml
82 lines (71 loc) · 3.21 KB
/
ControlExample.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Uno.Toolkit.Samples">
<Style x:Key="DefaultControlExampleStyle"
TargetType="local:ControlExample">
<Setter Property="Padding" Value="12" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:ControlExample">
<Grid x:Name="RootGrid" BorderBrush="{StaticResource SystemControlBackgroundChromeMediumLowBrush}" BorderThickness="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ContentPresenter x:Name="ContentPresenter"
Grid.Column="0"
Content="{TemplateBinding Content}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
<ContentPresenter x:Name="OptionsPresenter"
Grid.Column="1"
Content="{TemplateBinding Options}"
Background="{StaticResource SystemControlBackgroundChromeMediumLowBrush}"
Margin="0,12,12,12"
Padding="12"
MaxWidth="320"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="IntermediateLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource DesktopAdaptiveThresholdWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters />
</VisualState>
<VisualState x:Name="PhoneLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ContentPresenter.(Grid.ColumnSpan)" Value="2" />
<Setter Target="OptionsPresenter.(Grid.Column)" Value="0" />
<Setter Target="OptionsPresenter.(Grid.Row)" Value="1" />
<Setter Target="OptionsPresenter.Margin" Value="0" />
<Setter Target="OptionsPresenter.MaxWidth" Value="Infinity" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="local:ControlExample"
BasedOn="{StaticResource DefaultControlExampleStyle}" />
</ResourceDictionary>