Repository navigation
Expand file tree
/
Copy pathTokenizingTextBox.xaml
More file actions
181 lines (168 loc) · 11.4 KB
/
Copy pathTokenizingTextBox.xaml
File metadata and controls
181 lines (168 loc) · 11.4 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
174
175
176
177
178
179
180
181
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.TokenizingTextBox/TokenizingTextBoxItem.Token.xaml" />
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.TokenizingTextBox/TokenizingTextBoxItem.AutoSuggestBox.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Resources for TokenizingTextBox -->
<Thickness x:Key="TokenizingTextBoxPadding">3,2,3,2</Thickness>
<Thickness x:Key="TokenizingTextBoxPresenterMargin">0,0,6,0</Thickness>
<x:Double x:Key="TokenizingTextBoxTokenSpacing">2</x:Double>
<controls:TokenizingTextBoxStyleSelector x:Key="TokenizingTextBoxStyleSelector"
TextStyle="{StaticResource TokenizingTextBoxItemTextStyle}"
TokenStyle="{StaticResource TokenizingTextBoxItemTokenStyle}" />
<!-- Default style for TokenizingTextBox -->
<Style BasedOn="{StaticResource DefaultTokenizingTextBoxStyle}"
TargetType="controls:TokenizingTextBox" />
<Style x:Key="DefaultTokenizingTextBoxStyle"
TargetType="controls:TokenizingTextBox">
<Setter Property="AutoSuggestBoxStyle" Value="{StaticResource SystemAutoSuggestBoxStyle}" />
<Setter Property="AutoSuggestBoxTextBoxStyle" Value="{StaticResource TokenizingTextBoxTextBoxStyle}" />
<Setter Property="Foreground" Value="{ThemeResource TextControlForeground}" />
<Setter Property="Background" Value="{ThemeResource TextControlBackground}" />
<Setter Property="BorderBrush" Value="{ThemeResource TextControlBorderBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThickness}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="TabNavigation" Value="Once" />
<win:Setter Property="IsSwipeEnabled"
Value="False" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Padding" Value="{StaticResource TokenizingTextBoxPadding}" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<win:Setter Property="ScrollViewer.IsHorizontalRailEnabled"
Value="True" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" />
<win:Setter Property="ScrollViewer.IsVerticalRailEnabled"
Value="True" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
<win:Setter Property="ScrollViewer.IsDeferredScrollingEnabled"
Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" />
<Setter Property="TokenSpacing" Value="{StaticResource TokenizingTextBoxTokenSpacing}" />
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="IsItemClickEnabled" Value="True" />
<win:Setter Property="ItemContainerTransitions">
<Setter.Value>
<TransitionCollection />
</Setter.Value>
</win:Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<controls:WrapPanel ui:FrameworkElementExtensions.AncestorType="controls:TokenizingTextBox"
HorizontalSpacing="{Binding (ui:FrameworkElementExtensions.Ancestor).TokenSpacing, RelativeSource={RelativeSource Self}}"
StretchChild="Last"
VerticalSpacing="{Binding (ui:FrameworkElementExtensions.Ancestor).TokenSpacing, RelativeSource={RelativeSource Self}}" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyleSelector" Value="{StaticResource TokenizingTextBoxStyleSelector}" />
<Setter Property="Template" Value="{StaticResource TokenizingTextBoxTemplate}" />
</Style>
<ControlTemplate x:Key="TokenizingTextBoxTemplate"
TargetType="controls:TokenizingTextBox">
<Grid Name="RootPanel">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundVisual"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource TextControlBackgroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundVisual"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource TextControlBorderBrushDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundVisual"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource TextControlBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundVisual"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource TextControlBackgroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="BackgroundVisual.BorderBrush" Value="Transparent" />
<Setter Target="FocusVisual.BorderThickness" Value="{ThemeResource TextControlBorderThemeThicknessFocused}" />
<Setter Target="FocusVisual.Opacity" Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter Margin="{ThemeResource TextBoxTopHeaderMargin}"
VerticalAlignment="Top"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
FontWeight="Normal"
Foreground="{ThemeResource TextControlHeaderForeground}"
TextWrapping="Wrap"
Transitions="{TemplateBinding HeaderTransitions}" />
<Border x:Name="BackgroundVisual"
Grid.Row="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border x:Name="FocusVisual"
Grid.Row="1"
Background="{ThemeResource TextControlBackgroundFocused}"
BorderBrush="{ThemeResource TextControlBorderBrushFocused}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Opacity="0" />
<!-- Background in WinUI is TextControlBackgroundFocused, but that uses a different resource in WinUI than system -->
<ScrollViewer x:Name="ScrollViewer"
Grid.Row="1"
win:AutomationProperties.AccessibilityView="Raw"
win:IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
win:IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
win:IsHorizontalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsHorizontalScrollChainingEnabled}"
win:IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
win:IsVerticalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsVerticalScrollChainingEnabled}"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
TabNavigation="{TemplateBinding TabNavigation}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
<ItemsPresenter Margin="{StaticResource TokenizingTextBoxPresenterMargin}"
Padding="{TemplateBinding Padding}" />
</ScrollViewer>
<ContentPresenter Grid.Row="2"
VerticalAlignment="Top"
Content="{TemplateBinding Footer}"
ContentTemplate="{TemplateBinding FooterTemplate}"
FontWeight="Normal"
TextWrapping="Wrap"
Transitions="{TemplateBinding FooterTransitions}" />
</Grid>
</ControlTemplate>
</ResourceDictionary>