1
- <UserControl x : Class =" MaterialDesignColors.WpfExample.TextFields"
1
+ <UserControl x : Class =" MaterialDesignColors.WpfExample.TextFields"
2
2
xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
3
xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
4
4
xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
7
7
xmlns : wpfExample =" clr-namespace:MaterialDesignColors.WpfExample"
8
8
mc : Ignorable =" d"
9
9
d : DesignHeight =" 300" d : DesignWidth =" 600" Loaded =" UserControl_Loaded" >
10
- <UserControl .Resources>
11
- <ResourceDictionary >
12
- <ResourceDictionary .MergedDictionaries>
10
+ <UserControl .Resources>
11
+ <ResourceDictionary >
12
+ <ResourceDictionary .MergedDictionaries>
13
13
<!-- note you only need bring in these extra resource dictionaries when using non-default styles, so only bring them into your controls where the default style is not what you want -->
14
14
<ResourceDictionary Source =" pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ComboBox.xaml" />
15
15
<ResourceDictionary Source =" pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Slider.xaml" />
16
16
<ResourceDictionary Source =" pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
17
- </ResourceDictionary .MergedDictionaries>
18
- <Style TargetType =" {x:Type TextBox}" BasedOn =" {StaticResource MaterialDesignTextBox}" >
19
- <Setter Property =" HorizontalAlignment" Value =" Stretch" />
20
- <Setter Property =" Margin" Value =" 0 8 0 8" />
21
- </Style >
22
- <Style TargetType =" {x:Type ComboBox}" BasedOn =" {StaticResource MaterialDesignComboBox}" >
23
- <Setter Property =" HorizontalAlignment" Value =" Stretch" />
24
- <Setter Property =" Margin" Value =" 0 8 0 8" />
25
- </Style >
26
- <Style TargetType =" {x:Type Viewbox}" >
27
- <Setter Property =" Width" Value =" 18" />
28
- <Setter Property =" Height" Value =" 18" />
29
- <Setter Property =" Margin" Value =" 0 0 8 0" />
30
- <Setter Property =" VerticalAlignment" Value =" Center" />
31
- </Style >
17
+ </ResourceDictionary .MergedDictionaries>
18
+ <Style TargetType =" {x:Type TextBox}" BasedOn =" {StaticResource MaterialDesignTextBox}" >
19
+ <Setter Property =" HorizontalAlignment" Value =" Stretch" />
20
+ <Setter Property =" Margin" Value =" 0 8 0 8" />
21
+ </Style >
22
+ <Style TargetType =" {x:Type ComboBox}" BasedOn =" {StaticResource MaterialDesignComboBox}" >
23
+ <Setter Property =" HorizontalAlignment" Value =" Stretch" />
24
+ <Setter Property =" Margin" Value =" 0 8 0 8" />
25
+ </Style >
26
+ <Style TargetType =" {x:Type Viewbox}" >
27
+ <Setter Property =" Width" Value =" 18" />
28
+ <Setter Property =" Height" Value =" 18" />
29
+ <Setter Property =" Margin" Value =" 0 0 8 0" />
30
+ <Setter Property =" VerticalAlignment" Value =" Center" />
31
+ </Style >
32
32
<Style TargetType =" {x:Type Slider}" BasedOn =" {StaticResource MaterialDesignSlider}" >
33
- <Setter Property =" Margin" Value =" 0 8 0 8" />
34
- </Style >
35
- </ResourceDictionary >
36
- </UserControl .Resources>
37
- <Grid Margin =" 16" VerticalAlignment =" Top" >
38
- <Grid .ColumnDefinitions>
39
- <ColumnDefinition Width =" Auto" />
40
- <ColumnDefinition Width =" 150" />
33
+ <Setter Property =" Margin" Value =" 0 8 0 8" />
34
+ </Style >
35
+ </ResourceDictionary >
36
+ </UserControl .Resources>
37
+ <Grid Margin =" 16" VerticalAlignment =" Top" >
38
+ <Grid .ColumnDefinitions>
41
39
<ColumnDefinition Width =" Auto" />
42
40
<ColumnDefinition Width =" 150" />
43
- <ColumnDefinition Width =" *" />
44
- </Grid .ColumnDefinitions>
45
- <Grid .RowDefinitions>
46
- <RowDefinition Height =" Auto" />
47
- <RowDefinition Height =" Auto" />
41
+ <ColumnDefinition Width =" Auto" />
42
+ <ColumnDefinition Width =" 150" />
43
+ <ColumnDefinition Width =" *" />
44
+ </Grid .ColumnDefinitions>
45
+ <Grid .RowDefinitions>
46
+ <RowDefinition Height =" Auto" />
47
+ <RowDefinition Height =" Auto" />
48
+ <RowDefinition Height =" Auto" />
49
+ <RowDefinition Height =" Auto" />
48
50
<RowDefinition Height =" Auto" />
49
51
<RowDefinition Height =" Auto" />
50
- <RowDefinition Height =" Auto" />
51
- <RowDefinition Height =" Auto" />
52
- <RowDefinition Height =" Auto" />
53
- <RowDefinition Height =" Auto" />
54
52
<RowDefinition Height =" Auto" />
55
- <RowDefinition Height =" Auto" />
56
- </Grid .RowDefinitions>
57
- <Viewbox Grid.Row=" 0" Grid.Column=" 0" >
58
- <Canvas Width =" 24" Height =" 24" >
59
- <Path Data =" M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"
53
+ <RowDefinition Height =" Auto" />
54
+ <RowDefinition Height =" Auto" />
55
+ </Grid .RowDefinitions>
56
+ <Viewbox Grid.Row=" 0" Grid.Column=" 0" >
57
+ <Canvas Width =" 24" Height =" 24" >
58
+ <Path Data =" M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"
60
59
Fill =" {Binding ElementName=NameTextBox, Path=BorderBrush}" />
61
- </Canvas >
62
- </Viewbox >
60
+ </Canvas >
61
+ </Viewbox >
63
62
<TextBox Grid.Row=" 0" Grid.Column=" 1"
64
63
x : Name =" NameTextBox"
65
64
wpf:TextFieldAssist.Hint=" Name" >
71
70
</Binding >
72
71
</TextBox .Text>
73
72
</TextBox >
74
- <TextBlock Grid.Row=" 0" Grid.Column=" 2" VerticalAlignment =" Center" Margin =" 16 0 8 0" >OS</TextBlock >
75
- <ComboBox Grid.Row=" 0" Grid.Column=" 3" wpf:TextFieldAssist.Hint=" OS" >
76
- <ComboBoxItem >Andoid</ComboBoxItem >
77
- <ComboBoxItem >iOS</ComboBoxItem >
78
- <ComboBoxItem >Linux</ComboBoxItem >
79
- <ComboBoxItem >Windows</ComboBoxItem >
80
- </ComboBox >
73
+ <TextBlock Grid.Row=" 0" Grid.Column=" 2" VerticalAlignment =" Center" Margin =" 16 0 8 0" >OS</TextBlock >
74
+ <ComboBox Grid.Row=" 0" Grid.Column=" 3" wpf:TextFieldAssist.Hint=" OS" >
75
+ <ComboBoxItem >Andoid</ComboBoxItem >
76
+ <ComboBoxItem >iOS</ComboBoxItem >
77
+ <ComboBoxItem >Linux</ComboBoxItem >
78
+ <ComboBoxItem >Windows</ComboBoxItem >
79
+ </ComboBox >
81
80
<TextBox Grid.Row=" 0" Grid.RowSpan=" 2" Grid.Column=" 4" TextWrapping =" Wrap" VerticalAlignment =" Stretch" Margin =" 16 0 0 0"
82
81
MinWidth =" 280"
83
82
AcceptsReturn =" True"
84
83
VerticalScrollBarVisibility =" Auto"
85
84
wpf:TextFieldAssist.Hint=" Multiline text"
86
85
Height =" 80" >Multiline. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. The quick brown fox jumps over the lazy dog. War and peace. Keep going. Go on. For how long? Not long. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</TextBox >
87
86
<Viewbox Grid.Row=" 1" Grid.Column=" 0" >
88
- <Canvas Width =" 24" Height =" 24" >
89
- <Path Data =" M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z"
87
+ <Canvas Width =" 24" Height =" 24" >
88
+ <Path Data =" M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z"
90
89
Fill =" {Binding ElementName=PhoneTextBox, Path=BorderBrush}" />
91
- </Canvas >
92
- </Viewbox >
93
- <TextBox Grid.Row=" 1" Grid.Column=" 1"
90
+ </Canvas >
91
+ </Viewbox >
92
+ <TextBox Grid.Row=" 1" Grid.Column=" 1"
94
93
x : Name =" PhoneTextBox"
95
94
wpf:TextFieldAssist.Hint=" Phone"
96
95
/>
97
- <TextBlock Grid.Row=" 1" Grid.Column=" 2" VerticalAlignment =" Center" Margin =" 16 0 8 0" >Fruit</TextBlock >
98
- <ComboBox Grid.Row=" 1" Grid.Column=" 3" wpf:TextFieldAssist.Hint=" Search" IsEditable =" True" wpf:TextFieldAssist.HintOpacity=" .26" >
99
- <ComboBoxItem >Apple</ComboBoxItem >
100
- <ComboBoxItem >Banana</ComboBoxItem >
101
- <ComboBoxItem >Pear</ComboBoxItem >
102
- <ComboBoxItem >Orange</ComboBoxItem >
103
- </ComboBox >
104
- <Viewbox Grid.Row=" 2" Grid.Column=" 0" >
105
- <Canvas Width =" 24" Height =" 24" >
106
- <Path Data =" M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M13,10V6H11V10H13M13,14V12H11V14H13Z"
96
+ <TextBlock Grid.Row=" 1" Grid.Column=" 2" VerticalAlignment =" Center" Margin =" 16 0 8 0" >Fruit</TextBlock >
97
+ <ComboBox Grid.Row=" 1" Grid.Column=" 3" wpf:TextFieldAssist.Hint=" Search" IsEditable =" True" wpf:TextFieldAssist.HintOpacity=" .26" >
98
+ <ComboBoxItem >Apple</ComboBoxItem >
99
+ <ComboBoxItem >Banana</ComboBoxItem >
100
+ <ComboBoxItem >Pear</ComboBoxItem >
101
+ <ComboBoxItem >Orange</ComboBoxItem >
102
+ </ComboBox >
103
+ <Viewbox Grid.Row=" 2" Grid.Column=" 0" >
104
+ <Canvas Width =" 24" Height =" 24" >
105
+ <Path Data =" M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M13,10V6H11V10H13M13,14V12H11V14H13Z"
107
106
Fill =" {Binding ElementName=CommentTextBox, Path=BorderBrush}" />
108
- </Canvas >
109
- </Viewbox >
110
- <TextBox Grid.Row=" 2" Grid.Column=" 1"
107
+ </Canvas >
108
+ </Viewbox >
109
+ <TextBox Grid.Row=" 2" Grid.Column=" 1"
111
110
x : Name =" CommentTextBox"
112
111
wpf:TextFieldAssist.Hint=" Comment"
113
112
/>
114
113
<Viewbox Grid.Row=" 2" Grid.Column=" 2" >
115
- <Canvas Width =" 24" Height =" 24" >
116
- <Path Data =" M7,14A2,2 0 0,1 5,12A2,2 0 0,1 7,10A2,2 0 0,1 9,12A2,2 0 0,1 7,14M12.65,10C11.83,7.67 9.61,6 7,6A6,6 0 0,0 1,12A6,6 0 0,0 7,18C9.61,18 11.83,16.33 12.65,14H17V18H21V14H23V10H12.65Z"
114
+ <Canvas Width =" 24" Height =" 24" >
115
+ <Path Data =" M7,14A2,2 0 0,1 5,12A2,2 0 0,1 7,10A2,2 0 0,1 9,12A2,2 0 0,1 7,14M12.65,10C11.83,7.67 9.61,6 7,6A6,6 0 0,0 1,12A6,6 0 0,0 7,18C9.61,18 11.83,16.33 12.65,14H17V18H21V14H23V10H12.65Z"
117
116
Fill =" {Binding ElementName=PasswordBox, Path=BorderBrush}" />
118
- </Canvas >
119
- </Viewbox >
120
- <PasswordBox Grid.Row=" 2" Grid.Column=" 3"
117
+ </Canvas >
118
+ </Viewbox >
119
+ <PasswordBox Grid.Row=" 2" Grid.Column=" 3"
121
120
x : Name =" PasswordBox"
122
121
wpf:TextFieldAssist.Hint=" Password" />
123
-
122
+
124
123
<TextBox Grid.Row=" 3" Grid.Column=" 1" wpf:TextFieldAssist.Hint=" Floating Hint" Style =" {StaticResource MaterialDesignFloatingHintTextBox}"
125
- Margin =" 0 8 0 8" />
124
+ Margin =" 0 8 0 8" />
126
125
<ComboBox Grid.Row=" 3" Grid.Column=" 3" wpf:TextFieldAssist.Hint=" OS" Style =" {StaticResource MaterialDesignFloatingHintComboBox}"
127
126
Margin =" 0 8 0 8" >
128
127
<ComboBoxItem >Andoid</ComboBoxItem >
142
141
</ComboBox >
143
142
144
143
<DatePicker Grid.Row=" 5" Grid.Column=" 1" Width =" 100" HorizontalAlignment =" Left" Margin =" 0 8 0 8"
145
- wpf:TextFieldAssist.Hint=" Pick Date" />
146
- <wpf : TimePicker Grid.Row=" 5" Grid.Column=" 3" VerticalAlignment =" Top" Width =" 100" HorizontalAlignment =" Left" Margin =" 0 8 0 8"
144
+ wpf:TextFieldAssist.Hint=" Pick Date" />
145
+ <wpf : TimePicker Grid.Row=" 5" Grid.Column=" 3" VerticalAlignment =" Top" Width =" 100" HorizontalAlignment =" Left" Margin =" 0 8 0 8"
147
146
wpf:TextFieldAssist.Hint=" Custom hint" />
148
- <wpf : TimePicker Grid.Row=" 5" Grid.Column=" 4" x : Name =" PresetTimePicker" VerticalAlignment =" Top" Width =" 100" HorizontalAlignment =" Left" Margin =" 0 8 0 8" />
149
-
150
- <wpf : TimePicker Is24Hours =" True" Grid.Row=" 6" Grid.Column=" 1" x : Name =" PresetTimePicker24" VerticalAlignment =" Top" Width =" 100" HorizontalAlignment =" Left" Margin =" 0 8 0 8" />
151
-
152
- <Slider Grid.Row=" 7" Grid.Column=" 1" TickFrequency =" 5" Orientation =" Horizontal" Minimum =" 1" Maximum =" 50" Value =" 25" />
153
- <StackPanel Orientation =" Horizontal" Grid.Row=" 6" Grid.Column=" 3" Grid.RowSpan=" 3" >
154
- <Slider TickFrequency =" 5" TickPlacement =" BottomRight" Orientation =" Vertical" Minimum =" 1" Maximum =" 50" />
155
- <Slider TickFrequency =" 25" TickPlacement =" TopLeft" Orientation =" Vertical" Minimum =" 1" Maximum =" 50" IsEnabled =" False" Margin =" 24 8 0 8" />
156
- </StackPanel >
157
- <Slider Grid.Row=" 8" Grid.Column=" 1" TickFrequency =" 5" Orientation =" Horizontal" TickPlacement =" BottomRight" Minimum =" 1" Maximum =" 50" Value =" 25" IsSelectionRangeEnabled =" True" />
158
- <Slider Grid.Row=" 9" Grid.Column=" 1" TickFrequency =" 5" Orientation =" Horizontal" TickPlacement =" BottomRight" Minimum =" 1" Maximum =" 50" Value =" 25" IsEnabled =" False" />
159
-
160
- </Grid >
161
- </UserControl >
147
+ <wpf : TimePicker Grid.Row=" 5" Grid.Column=" 4" Is24Hours =" True" x : Name =" PresetTimePicker" VerticalAlignment =" Top" Width =" 100" HorizontalAlignment =" Left" Margin =" 0 8 0 8" />
148
+ <Slider Grid.Row=" 6" Grid.Column=" 1" TickFrequency =" 5" Orientation =" Horizontal" Minimum =" 1" Maximum =" 50" Value =" 25" />
149
+ <StackPanel Orientation =" Horizontal" Grid.Row=" 6" Grid.Column=" 3" Grid.RowSpan=" 3" >
150
+ <Slider TickFrequency =" 5" TickPlacement =" BottomRight" Orientation =" Vertical" Minimum =" 1" Maximum =" 50" />
151
+ <Slider TickFrequency =" 25" TickPlacement =" TopLeft" Orientation =" Vertical" Minimum =" 1" Maximum =" 50" IsEnabled =" False" Margin =" 24 8 0 8" />
152
+ </StackPanel >
153
+ <Slider Grid.Row=" 7" Grid.Column=" 1" TickFrequency =" 5" Orientation =" Horizontal" TickPlacement =" BottomRight" Minimum =" 1" Maximum =" 50" Value =" 25" IsSelectionRangeEnabled =" True" />
154
+ <Slider Grid.Row=" 8" Grid.Column=" 1" TickFrequency =" 5" Orientation =" Horizontal" TickPlacement =" BottomRight" Minimum =" 1" Maximum =" 50" Value =" 25" IsEnabled =" False" />
155
+
156
+ </Grid >
157
+ </UserControl >
0 commit comments