-
-
Notifications
You must be signed in to change notification settings - Fork 957
Expand file tree
/
Copy pathButtonPage.xaml
More file actions
173 lines (162 loc) · 9.08 KB
/
ButtonPage.xaml
File metadata and controls
173 lines (162 loc) · 9.08 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<Page
x:Class="Wpf.Ui.Gallery.Views.Pages.BasicInput.ButtonPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wpf.Ui.Gallery.Views.Pages.BasicInput"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="ButtonPage"
controls:PageControlDocumentation.DocumentationType="{x:Type ui:Button}"
d:DataContext="{d:DesignInstance local:ButtonPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="1250"
d:DesignWidth="800"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Controls/Button/Button.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="ViewBoxCustomButtonContentTemplate">
<Viewbox
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stretch="Uniform"
StretchDirection="Both">
<ContentPresenter
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{TemplateBinding Content}" />
</Viewbox>
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
<StackPanel Margin="0,0,0,24">
<controls:ControlExample
Margin="0"
HeaderText="Standard button."
XamlCode="<Button Content="Standard WPF button" />">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Content="Standard WPF button"
IsEnabled="{Binding ViewModel.IsSimpleButtonEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ButtonPage}, Mode=OneWay}" />
<CheckBox
Grid.Column="1"
Command="{Binding ViewModel.SimpleButtonCheckboxCheckedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ButtonPage}, Mode=OneWay}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay}"
Content="Disable button" />
</Grid>
</controls:ControlExample>
<controls:ControlExample
Margin="0,32,0,0"
HeaderText="WPF UI button."
XamlCode="<ui:Button Content="WPF UI button" Icon="Fluent24" />">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:Button
Grid.Column="0"
Content="WPF UI button"
Icon="{ui:SymbolIcon Fluent24}"
IsEnabled="{Binding ViewModel.IsUiButtonEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ButtonPage}, Mode=OneWay}" />
<CheckBox
Grid.Column="1"
Command="{Binding ViewModel.UiButtonCheckboxCheckedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ButtonPage}, Mode=OneWay}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay}"
Content="Disable button" />
</Grid>
</controls:ControlExample>
<controls:ControlExample
Margin="0,32,0,0"
HeaderText="WPF UI Accent button."
XamlCode="<ui:Button Appearance="Primary" />">
<ui:Button
Appearance="Primary"
Content="WPF UI button"
Icon="{ui:SymbolIcon Fluent24}" />
</controls:ControlExample>
<controls:ControlExample
Margin="0,32,0,0"
HeaderText="WPF UI Brush icon."
XamlCode="<ui:Button Appearance="Primary" />">
<controls:ControlExample.Resources>
<DrawingBrush x:Key="JSPhone">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M3,16L14.001,16 14.001,0 3,0z" />
<GeometryDrawing Brush="#FFF16320" Geometry="F1M12,12L5,12 5,2 12,2z M12,14L11,14 11,13 12,13z M9,14L8,14 8,13 9,13z M6,14L5,14 5,13 6,13z M4,15L13,15 13,1 4,1z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M12,12L5,12 5,2 12,2z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M5,14L6,14 6,13 5,13z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8,14L9,14 9,13 8,13z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M11,14L12,14 12,13 11,13z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<DrawingBrush x:Key="StatusCriticalError" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M16,8C16,12.418 12.418,16 8,16 3.582,16 0,12.418 0,8 0,3.582 3.582,0 8,0 12.418,0 16,3.582 16,8" />
<GeometryDrawing Brush="#FFE41400" Geometry="F1M12.4141,11L11.0001,12.414 8.0001,9.414 5.0001,12.414 3.5871,11 6.5861,8 3.5871,5 5.0001,3.586 8.0001,6.586 11.0001,3.586 12.4141,5 9.4141,8z M8.0001,1C4.1351,1 1.0001,4.135 1.0001,8 1.0001,11.865 4.1351,15 8.0001,15 11.8651,15 15.0001,11.865 15.0001,8 15.0001,4.135 11.8651,1 8.0001,1" />
<GeometryDrawing Brush="#FFFFFFFF" Geometry="F1M9.4141,8L12.4141,11 11.0001,12.414 8.0001,9.414 5.0001,12.414 3.5861,11 6.5861,8 3.5861,5 5.0001,3.586 8.0001,6.586 11.0001,3.586 12.4141,5z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</controls:ControlExample.Resources>
<StackPanel>
<ui:Button
Appearance="Primary"
Content="WPF UI button" FontSize="20" FontWeight="Black"
Icon="{ui:DrawingBrushIcon {StaticResource StatusCriticalError}, Size=24}">
</ui:Button>
</StackPanel>
</controls:ControlExample>
<controls:ControlExample
Margin="0,32,0,0"
HeaderText="WPF UI button with FontIcon."
XamlCode="<ui:Button Appearance="Primary" />">
<ui:Button
Appearance="Primary"
Content="WPF UI button with font icon"
Icon="{ui:FontIcon '🌈'}" />
</controls:ControlExample>
<controls:ControlExample
Margin="0,32,0,0"
HeaderText="WPF UI button with ImageIcon."
XamlCode="<ui:Button Appearance="Primary" />">
<ui:Button
Appearance="Primary"
Content="WPF UI button with image icon"
Icon="{ui:ImageIcon 'pack://application:,,,/Assets/wpfui.png'}" />
</controls:ControlExample>
<controls:ControlExample
Margin="0,32,0,0"
HeaderText="WPF UI button with modified content template."
XamlCode="<ui:Button Appearance="Primary" />">
<ui:Button Width="40" ContentTemplate="{StaticResource ViewBoxCustomButtonContentTemplate}">
<Canvas Width="47" Height="99">
<Path Data="M0,19H18V84h29v15H0V19Z" Fill="{DynamicResource TextFillColorSecondaryBrush}" />
<Path Data="M46,80H29V15H0V0H46V80Z" Fill="{DynamicResource TextFillColorSecondaryBrush}" />
</Canvas>
</ui:Button>
</controls:ControlExample>
</StackPanel>
</Page>