-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathTextBox.xaml
840 lines (748 loc) · 47.8 KB
/
TextBox.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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:not_macos="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:macos="http://uno.ui/macos"
xmlns:um="using:Uno.Material"
mc:Ignorable="d macos">
<!--Expected TextBox behavior:
We are going a different route than the Official Material M2/M3 Google samples & the Material doc regarding the fact that the Placeholder will always be visible.
(cf. specs discussions here https://github.com/unoplatform/Uno.Themes/issues/974)
- Without Header/Placeholder, we will have a simple TextBox (matching Windows behavior)
- With a Placeholder and no Header, we will have a simple TextBox (matching Windows behavior).
- If there is a Header:
- Without a Placeholder, the Header moves up when focused and it will be empty underneath until some text is entered
- With a Placeholder, the Header does not move, it is already at the top and shows also the Placeholder underneath-->
<!-- Converters -->
<!-- New converters - todo adjust naming -->
<um:FromTextBoxEmptyStringToValueConverter x:Key="EmptyToNotFocusedContentCompositeTransformTranslateY"
HeaderAndPlaceholderValue="8"
HeaderOnlyValue="0"
HeaderOnlyWithTextValue="8"
PlaceholderOnlyValue="0"
NoHeaderAndNoPlaceholderValue="0" />
<um:FromTextBoxEmptyStringToValueConverter x:Key="EmptyToFocusedContentCompositeTransformTranslateY"
HeaderAndPlaceholderValue="8"
HeaderOnlyValue="8"
HeaderOnlyWithTextValue="8"
PlaceholderOnlyValue="0"
NoHeaderAndNoPlaceholderValue="0" />
<um:FromTextBoxEmptyStringToValueConverter x:Key="EmptyToHeaderCompositeTransformTranslateY"
HeaderAndPlaceholderValue="-11"
HeaderOnlyValue="0"
HeaderOnlyWithTextValue="-11"
PlaceholderOnlyValue="0"
NoHeaderAndNoPlaceholderValue="0" />
<um:FromTextBoxEmptyStringToValueConverter x:Key="EmptyToHeaderCompositeTransformScales"
HeaderAndPlaceholderValue="0.7"
HeaderOnlyValue="1"
HeaderOnlyWithTextValue="0.7"
PlaceholderOnlyValue="1"
NoHeaderAndNoPlaceholderValue="1" />
<!-- Path Data -->
<x:String x:Key="MaterialTextBoxClearGlyphData">M14.9482 6.46442L13.534 5.05021L9.99849 8.58574L6.46296 5.05021L5.04874 6.46442L8.58428 9.99995L5.04874 13.5355L6.46296 14.9497L9.99849 11.4142L13.534 14.9497L14.9482 13.5355L11.4127 9.99995L14.9482 6.46442ZM17.0696 2.92889C13.1663 -0.974342 6.83065 -0.974342 2.92742 2.92889C-0.975807 6.83212 -0.975807 13.1678 2.92742 17.071C6.83065 20.9743 13.1663 20.9743 17.0696 17.071C20.9728 13.1678 20.9728 6.83212 17.0696 2.92889ZM4.34164 15.6568C1.22329 12.5385 1.22329 7.46144 4.34164 4.3431C7.45998 1.22476 12.537 1.22476 15.6553 4.3431C18.7737 7.46144 18.7737 12.5385 15.6553 15.6568C12.537 18.7752 7.45998 18.7752 4.34164 15.6568Z</x:String>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<!--#region Fille Delete Button Brushes-->
<StaticResource x:Key="TextBoxDeleteButtonForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxDeleteButtonForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxDeleteButtonForegroundPressed" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxDeleteButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Leading Icon Brushes-->
<StaticResource x:Key="TextBoxLeadingIconForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxLeadingIconForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Filled TextBox Brushes-->
<StaticResource x:Key="FilledTextBoxBackground" ResourceKey="SurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxBackgroundPointerOver" ResourceKey="OnSurfaceVariantHoverBrush" />
<StaticResource x:Key="FilledTextBoxBackgroundFocused" ResourceKey="SurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxBackgroundDisabled" ResourceKey="OnSurfaceDisabledBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrush" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrushPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrushFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrushDisabled" ResourceKey="OnSurfaceDisabledBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundFocused" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="FilledTextBoxForeground" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxForegroundPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxForegroundFocused" ResourceKey="OnSurfaceBrush" />
<!-- In this case the opacity is not applied to the brush directly - known issue for ContentElement -->
<StaticResource x:Key="FilledTextBoxForegroundDisabled" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxForegroundOpacityDisabled" ResourceKey="LowOpacity" />
<StaticResource x:Key="FilledTextBoxPlaceholderForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxPlaceholderForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxPlaceholderForegroundFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="FilledTextBoxPlaceholderForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Outlined TextBox Brushes-->
<StaticResource x:Key="OutlinedTextBoxBorderBrush" ResourceKey="OutlineBrush" />
<StaticResource x:Key="OutlinedTextBoxBorderBrushPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxBorderBrushFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="OutlinedTextBoxBorderBrushDisabled" ResourceKey="OnSurfaceDisabledBrush" />
<StaticResource x:Key="OutlinedTextBoxForeground" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxForegroundPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxForegroundFocused" ResourceKey="OnSurfaceBrush" />
<!-- In this case the opacity is not applied to the brush directly - known issue for ContentElement -->
<StaticResource x:Key="OutlinedTextBoxForegroundDisabled" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxForegroundOpacityDisabled" ResourceKey="LowOpacity" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForegroundFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Typo-->
<StaticResource x:Key="OutlinedTextBoxFontFamily" ResourceKey="MaterialMediumFontFamily" />
<StaticResource x:Key="OutlinedTextBoxFontWeight" ResourceKey="BodyLargeFontWeight" />
<StaticResource x:Key="OutlinedTextBoxFontSize" ResourceKey="BodyLargeFontSize" />
<StaticResource x:Key="OutlinedTextBoxCharacterSpacing" ResourceKey="BodyLargeCharacterSpacing" />
<StaticResource x:Key="FilledTextBoxFontFamily" ResourceKey="MaterialMediumFontFamily" />
<StaticResource x:Key="FilledTextBoxFontWeight" ResourceKey="BodyLargeFontWeight" />
<StaticResource x:Key="FilledTextBoxFontSize" ResourceKey="BodyLargeFontSize" />
<StaticResource x:Key="FilledTextBoxCharacterSpacing" ResourceKey="BodyLargeCharacterSpacing" />
<StaticResource x:Key="FilledTextBoxBorderThicknessNormal" ResourceKey="TextBoxOutlinedStrokeHeight" />
<StaticResource x:Key="FilledTextBoxBorderThicknessFocused" ResourceKey="TextBoxFocusStrokeWidth" />
<!--#endregion-->
<!--#region Delete Button Style-->
<x:Double x:Key="MaterialTextBoxClearGlyphWidth">20</x:Double>
<x:Double x:Key="MaterialTextBoxClearGlyphHeight">20</x:Double>
<!--#endregion-->
<!--#region Filled TextBox Style-->
<CornerRadius x:Key="MaterialFilledTextBoxCornerRadius">4,4,0,0</CornerRadius>
<macos:Thickness x:Key="MaterialFilledTextBoxPadding">16,7</macos:Thickness>
<not_macos:Thickness x:Key="MaterialFilledTextBoxPadding">16,8</not_macos:Thickness>
<x:Double x:Key="MaterialFilledTextBoxMinHeight">58</x:Double>
<x:Double x:Key="MaterialFilledTextBoxBorderHeightFocused">2</x:Double>
<!--#endregion-->
<!--#region Outlined TextBox Style-->
<x:Double x:Key="MaterialOutlinedTextBoxBorderThickness">1</x:Double>
<CornerRadius x:Key="MaterialOutlinedTextBoxCornerRadius">4</CornerRadius>
<macos:Thickness x:Key="MaterialOutlinedTextBoxPadding">16,7,14,7</macos:Thickness>
<not_macos:Thickness x:Key="MaterialOutlinedTextBoxPadding">16,8</not_macos:Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxMinHeight">56</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxBorderPadding">1</Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessFocused">2</x:Double>
<!--#endregion-->
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!--#region Fille Delete Button Brushes-->
<StaticResource x:Key="TextBoxDeleteButtonForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxDeleteButtonForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxDeleteButtonForegroundPressed" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxDeleteButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Leading Icon Brushes-->
<StaticResource x:Key="TextBoxLeadingIconForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="TextBoxLeadingIconForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Filled TextBox Brushes-->
<StaticResource x:Key="FilledTextBoxBackground" ResourceKey="SurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxBackgroundPointerOver" ResourceKey="OnSurfaceVariantHoverBrush" />
<StaticResource x:Key="FilledTextBoxBackgroundFocused" ResourceKey="SurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxBackgroundDisabled" ResourceKey="OnSurfaceDisabledBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrush" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrushPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrushFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="FilledTextBoxBorderBrushDisabled" ResourceKey="OnSurfaceDisabledBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundFocused" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="FilledTextBoxForeground" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxForegroundPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxForegroundFocused" ResourceKey="OnSurfaceBrush" />
<!-- In this case the opacity is not applied to the brush directly - known issue for ContentElement -->
<StaticResource x:Key="FilledTextBoxForegroundDisabled" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="FilledTextBoxForegroundOpacityDisabled" ResourceKey="LowOpacity" />
<StaticResource x:Key="FilledTextBoxPlaceholderForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxPlaceholderForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxPlaceholderForegroundFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="FilledTextBoxPlaceholderForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Outlined TextBox Brushes-->
<StaticResource x:Key="OutlinedTextBoxBorderBrush" ResourceKey="OutlineBrush" />
<StaticResource x:Key="OutlinedTextBoxBorderBrushPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxBorderBrushFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="OutlinedTextBoxBorderBrushDisabled" ResourceKey="OnSurfaceDisabledBrush" />
<StaticResource x:Key="OutlinedTextBoxForeground" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxForegroundPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxForegroundFocused" ResourceKey="OnSurfaceBrush" />
<!-- In this case the opacity is not applied to the brush directly - known issue for ContentElement -->
<StaticResource x:Key="OutlinedTextBoxForegroundDisabled" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="OutlinedTextBoxForegroundOpacityDisabled" ResourceKey="LowOpacity" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForegroundFocused" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="OutlinedTextBoxPlaceholderForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->
<!--#region Typo-->
<StaticResource x:Key="OutlinedTextBoxFontFamily" ResourceKey="MaterialMediumFontFamily" />
<StaticResource x:Key="OutlinedTextBoxFontWeight" ResourceKey="BodyLargeFontWeight" />
<StaticResource x:Key="OutlinedTextBoxFontSize" ResourceKey="BodyLargeFontSize" />
<StaticResource x:Key="OutlinedTextBoxCharacterSpacing" ResourceKey="BodyLargeCharacterSpacing" />
<StaticResource x:Key="FilledTextBoxFontFamily" ResourceKey="MaterialMediumFontFamily" />
<StaticResource x:Key="FilledTextBoxFontWeight" ResourceKey="BodyLargeFontWeight" />
<StaticResource x:Key="FilledTextBoxFontSize" ResourceKey="BodyLargeFontSize" />
<StaticResource x:Key="FilledTextBoxCharacterSpacing" ResourceKey="BodyLargeCharacterSpacing" />
<StaticResource x:Key="FilledTextBoxBorderThicknessNormal" ResourceKey="TextBoxOutlinedStrokeHeight" />
<StaticResource x:Key="FilledTextBoxBorderThicknessFocused" ResourceKey="TextBoxFocusStrokeWidth" />
<!--#endregion-->
<!--#region Delete Button Style-->
<x:Double x:Key="MaterialTextBoxClearGlyphWidth">20</x:Double>
<x:Double x:Key="MaterialTextBoxClearGlyphHeight">20</x:Double>
<!--#endregion-->
<!--#region Filled TextBox Style-->
<CornerRadius x:Key="MaterialFilledTextBoxCornerRadius">4,4,0,0</CornerRadius>
<macos:Thickness x:Key="MaterialFilledTextBoxPadding">16,7</macos:Thickness>
<not_macos:Thickness x:Key="MaterialFilledTextBoxPadding">16,8</not_macos:Thickness>
<x:Double x:Key="MaterialFilledTextBoxMinHeight">58</x:Double>
<x:Double x:Key="MaterialFilledTextBoxBorderHeightFocused">2</x:Double>
<!--#endregion-->
<!--#region Outlined TextBox Style-->
<x:Double x:Key="MaterialOutlinedTextBoxBorderThickness">1</x:Double>
<CornerRadius x:Key="MaterialOutlinedTextBoxCornerRadius">4</CornerRadius>
<macos:Thickness x:Key="MaterialOutlinedTextBoxPadding">16,7,14,7</macos:Thickness>
<not_macos:Thickness x:Key="MaterialOutlinedTextBoxPadding">16,8</not_macos:Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxMinHeight">56</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxBorderPadding">1</Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessFocused">2</x:Double>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<Style x:Key="MaterialDeleteButtonStyle"
TargetType="Button">
<Setter Property="Foreground" Value="{ThemeResource TextBoxDeleteButtonForeground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="ButtonLayoutGrid"
Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="GlyphElement.Fill" Value="{ThemeResource TextBoxDeleteButtonForegroundPointerOver}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="GlyphElement.Fill" Value="{ThemeResource TextBoxDeleteButtonForegroundPressed}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="GlyphElement.Fill" Value="{ThemeResource TextBoxDeleteButtonForegroundDisabled}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Path x:Name="GlyphElement"
Data="{ThemeResource MaterialTextBoxClearGlyphData}"
Fill="{TemplateBinding Foreground}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"
Width="{ThemeResource MaterialTextBoxClearGlyphWidth}"
Height="{ThemeResource MaterialTextBoxClearGlyphHeight}"
AutomationProperties.AccessibilityView="Raw" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MaterialFilledTextBoxStyle"
TargetType="TextBox">
<Setter Property="Foreground" Value="{ThemeResource FilledTextBoxForeground}" />
<Setter Property="PlaceholderForeground" Value="{ThemeResource FilledTextBoxPlaceholderForeground}" />
<Setter Property="Background" Value="{ThemeResource FilledTextBoxBackground}" />
<Setter Property="BorderBrush" Value="{ThemeResource FilledTextBoxBorderBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="CornerRadius" Value="{ThemeResource MaterialFilledTextBoxCornerRadius}" />
<!-- Start: Body Large Typo -->
<Setter Property="FontFamily" Value="{ThemeResource FilledTextBoxFontFamily}" />
<Setter Property="FontWeight" Value="{ThemeResource FilledTextBoxFontWeight}" />
<Setter Property="FontSize" Value="{ThemeResource FilledTextBoxFontSize}" />
<Setter Property="CharacterSpacing" Value="{ThemeResource FilledTextBoxCharacterSpacing}" />
<!-- End: Body Large Typo -->
<macos:Setter Property="Padding"
Value="{ThemeResource MaterialFilledTextBoxPadding}" />
<not_macos:Setter Property="Padding"
Value="{ThemeResource MaterialFilledTextBoxPadding}" />
<Setter Property="MinHeight" Value="{ThemeResource MaterialFilledTextBoxMinHeight}" />
<!-- Workaround for WinUI issue: https://github.com/microsoft/microsoft-ui-xaml/issues/6388 -->
<Setter Property="um:ControlExtensions.Icon" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid x:Name="Root"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Target="HeaderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="ContentElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="PlaceholderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleX"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="NormalBorder.Fill"
Value="{ThemeResource FilledTextBoxBorderBrushPointerOver}" />
<Setter Target="Root.Background"
Value="{ThemeResource FilledTextBoxBackgroundPointerOver}" />
<Setter Target="PlaceholderElement.Foreground"
Value="{ThemeResource FilledTextBoxPlaceholderForegroundPointerOver}" />
<Setter Target="ContentElement.Foreground"
Value="{ThemeResource FilledTextBoxForegroundPointerOver}" />
<Setter Target="DeleteButton.Foreground"
Value="{ThemeResource FilledTextBoxDeleteButtonForegroundPointerOver}" />
<Setter Target="NormalBorder.Height"
Value="2" />
<!--Keep the Header upwards-->
<!-- If Text Header Placeholder needs to keep UP-->
<!-- Can't check Text and Placeholder -->
<Setter Target="HeaderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="ContentElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="PlaceholderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleX"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="NormalBorder.Fill"
Value="{ThemeResource FilledTextBoxBorderBrushDisabled}" />
<!-- In this case the opacity is not applied to the brush directly - known issue for ContentElement -->
<Setter Target="ContentElement.Foreground"
Value="{ThemeResource FilledTextBoxForegroundDisabled}" />
<Setter Target="ContentElement.Opacity"
Value="{ThemeResource FilledTextBoxForegroundOpacityDisabled}" />
<Setter Target="HeaderElement.Foreground"
Value="{ThemeResource FilledTextBoxPlaceholderForegroundDisabled}" />
<Setter Target="Root.Background"
Value="{ThemeResource FilledTextBoxBackgroundDisabled}" />
<Setter Target="DeleteButton.Foreground"
Value="{ThemeResource FilledTextBoxDeleteButtonForegroundDisabled}" />
<Setter Target="IconPresenter.Foreground"
Value="{ThemeResource TextBoxLeadingIconForegroundDisabled}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="HeaderElement.Foreground"
Value="{ThemeResource FilledTextBoxPlaceholderForegroundFocused}" />
<Setter Target="NormalBorder.Height"
Value="{ThemeResource MaterialFilledTextBoxBorderHeightFocused}" />
<Setter Target="NormalBorder.Fill"
Value="{ThemeResource FilledTextBoxBorderBrushFocused}" />
<Setter Target="Root.Background"
Value="{ThemeResource FilledTextBoxBackgroundFocused}" />
<Setter Target="ContentElement.Foreground"
Value="{ThemeResource FilledTextBoxForegroundFocused}" />
<Setter Target="DeleteButton.Foreground"
Value="{ThemeResource FilledTextBoxDeleteButtonForegroundFocused}" />
</VisualState.Setters>
<Storyboard>
<!--Animate Header Upwards-->
<DoubleAnimation Storyboard.TargetName="FocusedBorder_ScaleTransform"
Storyboard.TargetProperty="ScaleX"
Duration="{StaticResource MaterialAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="1" />
<DoubleAnimation Storyboard.TargetName="HeaderElement_CompositeTransform"
Storyboard.TargetProperty="TranslateY"
Duration="{StaticResource MaterialTextBoxAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="-11" />
<DoubleAnimation Storyboard.TargetName="ContentElement_CompositeTransform"
Storyboard.TargetProperty="TranslateY"
Duration="{StaticResource MaterialAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<DoubleAnimation Storyboard.TargetName="PlaceholderElement_CompositeTransform"
Storyboard.TargetProperty="TranslateY"
Duration="{StaticResource MaterialAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<DoubleAnimation Storyboard.TargetName="HeaderElement_CompositeTransform"
Storyboard.TargetProperty="ScaleX"
Duration="{StaticResource MaterialTextBoxAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="0.7" />
<DoubleAnimation Storyboard.TargetName="HeaderElement_CompositeTransform"
Storyboard.TargetProperty="ScaleY"
Duration="{StaticResource MaterialTextBoxAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="0.7" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible">
<VisualState.Setters>
<Setter Target="DeleteButton.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="ButtonCollapsed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Border in place to properly vertically center the icon inside when it's a one-line TextBox -->
<!-- but keep it in the same place and at the top when it's a multiline TextBox -->
<Border VerticalAlignment="Top"
Visibility="{Binding Path=(um:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MaterialNullToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
<ContentPresenter x:Name="IconPresenter"
Content="{Binding Path=(um:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Center"
Margin="0,11,8,0"
MaxHeight="34"
MaxWidth="34"
MinWidth="25"
Foreground="{ThemeResource TextBoxLeadingIconForeground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<!--Padding and VerticalAlignement="Top" are here to make sure the ScrollViewer does not move when entering a second line when multiline is enabled-->
<ScrollViewer x:Name="ContentElement"
Grid.Column="1"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsTabStop="False"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
Padding="0,10"
VerticalAlignment="Top"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
ZoomMode="Disabled"
AutomationProperties.AccessibilityView="Raw">
<ScrollViewer.RenderTransform>
<CompositeTransform x:Name="ContentElement_CompositeTransform" />
</ScrollViewer.RenderTransform>
</ScrollViewer>
<!-- Border in place to properly vertically center the placeholder inside when it's a one-line TextBox -->
<!-- but keep it in the same place and at the top when it's a multiline TextBox -->
<Border Grid.Column="1"
VerticalAlignment="Top">
<Border Height="38">
<TextBlock x:Name="HeaderElement"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
RenderTransformOrigin="0,0.5"
Text="{TemplateBinding Header}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.RenderTransform>
<CompositeTransform x:Name="HeaderElement_CompositeTransform" />
</TextBlock.RenderTransform>
</TextBlock>
</Border>
</Border>
<Border Grid.Column="1"
Height="38"
VerticalAlignment="Center">
<TextBlock x:Name="PlaceholderElement"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
RenderTransformOrigin="0,0.5"
Visibility="{Binding Text, Converter={StaticResource MaterialEmptyToVisible}, RelativeSource={RelativeSource TemplatedParent}}"
Text="{Binding PlaceholderText, RelativeSource={RelativeSource TemplatedParent}}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.RenderTransform>
<CompositeTransform x:Name="PlaceholderElement_CompositeTransform" />
</TextBlock.RenderTransform>
</TextBlock>
</Border>
<Button x:Name="DeleteButton"
Grid.Column="2"
Margin="8,0,0,0"
Foreground="{ThemeResource FilledTextBoxDeleteButtonForeground}"
IsTabStop="False"
Style="{StaticResource MaterialDeleteButtonStyle}"
VerticalAlignment="Stretch"
Visibility="Collapsed"
AutomationProperties.AccessibilityView="Raw" />
</Grid>
<Rectangle x:Name="NormalBorder"
Fill="{TemplateBinding BorderBrush}"
Height="{ThemeResource FilledTextBoxBorderThicknessNormal}"
VerticalAlignment="Bottom" />
<Rectangle x:Name="FocusedBorder"
Fill="{ThemeResource FilledTextBoxBorderBrushFocused}"
Height="{ThemeResource FilledTextBoxBorderThicknessFocused}"
VerticalAlignment="Bottom"
not_macos:RenderTransformOrigin="0.5,0.5"
macos:RenderTransformOrigin="0.0,0.5">
<Rectangle.RenderTransform>
<ScaleTransform x:Name="FocusedBorder_ScaleTransform" ScaleX="0" />
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MaterialOutlinedTextBoxStyle"
TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource OutlinedTextBoxForeground}" />
<Setter Property="PlaceholderForeground" Value="{ThemeResource OutlinedTextBoxPlaceholderForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource OutlinedTextBoxBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource MaterialOutlinedTextBoxBorderThickness}" />
<Setter Property="CornerRadius" Value="{ThemeResource MaterialOutlinedTextBoxCornerRadius}" />
<!-- Start: Body Large Typo -->
<Setter Property="FontFamily" Value="{ThemeResource OutlinedTextBoxFontFamily}" />
<Setter Property="FontWeight" Value="{ThemeResource OutlinedTextBoxFontWeight}" />
<Setter Property="FontSize" Value="{ThemeResource OutlinedTextBoxFontSize}" />
<Setter Property="CharacterSpacing" Value="{ThemeResource OutlinedTextBoxCharacterSpacing}" />
<!-- End: Body Large Typo -->
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<macos:Setter Property="Padding"
Value="{ThemeResource MaterialOutlinedTextBoxPadding}" />
<not_macos:Setter Property="Padding"
Value="{ThemeResource MaterialOutlinedTextBoxPadding}" />
<Setter Property="MinHeight" Value="{ThemeResource MaterialOutlinedTextBoxMinHeight}" />
<!-- Workaround for WinUI issue: https://github.com/microsoft/microsoft-ui-xaml/issues/6388 -->
<Setter Property="um:ControlExtensions.Icon" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border x:Name="RootBorder"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{ThemeResource MaterialOutlinedTextBoxBorderPadding}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Target="HeaderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="ContentElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="PlaceholderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleX"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootBorder.BorderBrush"
Value="{ThemeResource OutlinedTextBoxBorderBrushPointerOver}" />
<Setter Target="ContentElement.Foreground"
Value="{ThemeResource OutlinedTextBoxForegroundPointerOver}" />
<Setter Target="PlaceholderElement.Foreground"
Value="{ThemeResource OutlinedTextBoxPlaceholderForegroundPointerOver}" />
<Setter Target="RootBorder.BorderThickness"
Value="2" />
<Setter Target="RootBorder.Padding"
Value="0" />
<Setter Target="HeaderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="ContentElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="PlaceholderElement_CompositeTransform.TranslateY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToNotFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleX"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleY"
Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToHeaderCompositeTransformScales}, TargetNullValue=1, FallbackValue=1}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="RootBorder.BorderBrush"
Value="{ThemeResource OutlinedTextBoxBorderBrushDisabled}" />
<!-- In this case the opacity is not applied to the brush directly - known issue for ContentElement -->
<Setter Target="ContentElement.Foreground"
Value="{ThemeResource OutlinedTextBoxForegroundDisabled}" />
<Setter Target="ContentElement.Opacity"
Value="{ThemeResource OutlinedTextBoxForegroundOpacityDisabled}" />
<Setter Target="HeaderElement.Foreground"
Value="{ThemeResource OutlinedTextBoxPlaceholderForegroundDisabled}" />
<Setter Target="IconPresenter.Foreground"
Value="{ThemeResource TextBoxLeadingIconForegroundDisabled}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Focused">
<VisualState.Setters>
<!-- ICI -->
<Setter Target="RootBorder.BorderBrush"
Value="{ThemeResource OutlinedTextBoxBorderBrushFocused}" />
<Setter Target="ContentElement.Foreground"
Value="{ThemeResource OutlinedTextBoxForegroundFocused}" />
<Setter Target="HeaderElement.Foreground"
Value="{ThemeResource OutlinedTextBoxPlaceholderForegroundFocused}" />
<Setter Target="RootBorder.BorderThickness"
Value="{ThemeResource MaterialOutlinedTextBoxBorderThicknessFocused}" />
<Setter Target="RootBorder.Padding"
Value="0" />
</VisualState.Setters>
<Storyboard>
<!--Animate Header Upwards-->
<DoubleAnimation Storyboard.TargetName="HeaderElement_CompositeTransform"
Storyboard.TargetProperty="TranslateY"
Duration="{StaticResource MaterialTextBoxAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="-11" />
<DoubleAnimation Storyboard.TargetName="ContentElement_CompositeTransform"
Storyboard.TargetProperty="TranslateY"
Duration="{StaticResource MaterialAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<DoubleAnimation Storyboard.TargetName="PlaceholderElement_CompositeTransform"
Storyboard.TargetProperty="TranslateY"
Duration="{StaticResource MaterialAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<DoubleAnimation Storyboard.TargetName="HeaderElement_CompositeTransform"
Storyboard.TargetProperty="ScaleX"
Duration="{StaticResource MaterialTextBoxAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="0.7" />
<DoubleAnimation Storyboard.TargetName="HeaderElement_CompositeTransform"
Storyboard.TargetProperty="ScaleY"
Duration="{StaticResource MaterialTextBoxAnimationDuration}"
EasingFunction="{StaticResource MaterialEaseInOutFunction}"
To="0.7" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible">
<VisualState.Setters>
<Setter Target="DeleteButton.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="ButtonCollapsed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="Root"
Background="{TemplateBinding Background}"
Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Border in place to properly vertically center the icon inside when it's a one-line TextBox -->
<!-- but keep it in the same place and at the top when it's a multiline TextBox -->
<Border Height="38"
VerticalAlignment="Top">
<ContentPresenter x:Name="IconPresenter"
Content="{Binding Path=(um:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Center"
Width="20"
Margin="1,2,18,0"
Foreground="{ThemeResource TextBoxLeadingIconForeground}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Visibility="{Binding Path=(um:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MaterialNullToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}" />
</Border>
<ScrollViewer x:Name="ContentElement"
Grid.Column="1"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsTabStop="False"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
VerticalAlignment="Top"
Padding="0,10"
ZoomMode="Disabled"
AutomationProperties.AccessibilityView="Raw">
<ScrollViewer.RenderTransform>
<CompositeTransform x:Name="ContentElement_CompositeTransform" />
</ScrollViewer.RenderTransform>
</ScrollViewer>
<!-- Border in place to properly vertically center the placeholder inside when it's a one-line TextBox -->
<!-- but keep it in the same place and at the top when it's a multiline TextBox -->
<Border Grid.Column="1"
VerticalAlignment="Top">
<Border Height="38">
<TextBlock x:Name="HeaderElement"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
RenderTransformOrigin="0,0.5"
Text="{TemplateBinding Header}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.RenderTransform>
<CompositeTransform x:Name="HeaderElement_CompositeTransform" />
</TextBlock.RenderTransform>
</TextBlock>
</Border>
</Border>
<Border Grid.Column="1"
Height="38"
VerticalAlignment="Center">
<TextBlock x:Name="PlaceholderElement"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
Visibility="{Binding Text, Converter={StaticResource MaterialEmptyToVisible}, RelativeSource={RelativeSource TemplatedParent}}"
Text="{Binding PlaceholderText, RelativeSource={RelativeSource TemplatedParent}}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.RenderTransform>
<CompositeTransform x:Name="PlaceholderElement_CompositeTransform" />
</TextBlock.RenderTransform>
</TextBlock>
</Border>
<Button x:Name="DeleteButton"
Grid.Column="2"
Margin="8,0,0,0"
IsTabStop="False"
Style="{StaticResource MaterialDeleteButtonStyle}"
VerticalAlignment="Stretch"
Visibility="Collapsed"
AutomationProperties.AccessibilityView="Raw" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MaterialDefaultTextBoxStyle"
TargetType="TextBox"
BasedOn="{StaticResource MaterialOutlinedTextBoxStyle}" />
</ResourceDictionary>