TextBoxStyles.xaml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <Styles xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:content="clr-namespace:SukiUI.Content"
  4. xmlns:suki="https://github.com/kikipoulet/SukiUI"
  5. xmlns:theme="clr-namespace:SukiUI.Theme">
  6. <Design.PreviewWith>
  7. <Border Width="300"
  8. Padding="20"
  9. Background="{DynamicResource SukiBackground}">
  10. <StackPanel>
  11. <TextBox Width="200"
  12. Margin="5"
  13. Classes="Prefix"
  14. Text="avaloniaui.net"
  15. Watermark="https://" />
  16. <TextBox Width="200"
  17. Margin="5"
  18. Classes="Suffix"
  19. Text="avaloniaui"
  20. Watermark="@gmail.com" />
  21. <TextBox Width="200"
  22. Margin="5"
  23. Classes="BottomBar"
  24. Text="Elem" />
  25. <TextBox Width="200"
  26. Margin="5"
  27. Text="Elem" />
  28. <TextBox Width="200"
  29. Margin="5"
  30. IsEnabled="False"
  31. Text="Elem" />
  32. <TextBox Classes="NoShadow" Text="Elem" />
  33. <Panel>
  34. <Border Margin="0,0,0,25" Classes="Card">
  35. <StackPanel>
  36. <TextBlock Margin="6,0,0,3"
  37. FontSize="13"
  38. FontWeight="{DynamicResource DefaultDemiBold}"
  39. Text="Username" />
  40. <TextBox />
  41. <TextBlock Margin="6,18,0,3"
  42. FontSize="13"
  43. FontWeight="{DynamicResource DefaultDemiBold}"
  44. Text="Password" />
  45. <TextBox Margin="0,0,0,20" />
  46. </StackPanel>
  47. </Border>
  48. <Button Width="160"
  49. HorizontalAlignment="Center"
  50. VerticalAlignment="Bottom"
  51. Classes="Rounded Flat">
  52. <StackPanel HorizontalAlignment="Center"
  53. VerticalAlignment="Center"
  54. Orientation="Horizontal">
  55. <PathIcon Data="{x:Static content:Icons.Login}" Foreground="White" />
  56. <TextBlock Margin="10,0,0,0"
  57. FontSize="13"
  58. FontWeight="{DynamicResource DefaultDemiBold}"
  59. Foreground="White"
  60. Text="Sign In" />
  61. </StackPanel>
  62. </Button>
  63. </Panel>
  64. </StackPanel>
  65. </Border>
  66. </Design.PreviewWith>
  67. <Styles.Resources>
  68. <StreamGeometry x:Key="TextBoxClearButtonData">M 11.416016,10 20,1.4160156 18.583984,0 10,8.5839846 1.4160156,0 0,1.4160156 8.5839844,10 0,18.583985 1.4160156,20 10,11.416015 18.583984,20 20,18.583985 Z</StreamGeometry>
  69. <StreamGeometry x:Key="PasswordBoxRevealButtonData">m10.051 7.0032c2.215 0 4.0105 1.7901 4.0105 3.9984s-1.7956 3.9984-4.0105 3.9984c-2.215 0-4.0105-1.7901-4.0105-3.9984s1.7956-3.9984 4.0105-3.9984zm0 1.4994c-1.3844 0-2.5066 1.1188-2.5066 2.499s1.1222 2.499 2.5066 2.499 2.5066-1.1188 2.5066-2.499-1.1222-2.499-2.5066-2.499zm0-5.0026c4.6257 0 8.6188 3.1487 9.7267 7.5613 0.10085 0.40165-0.14399 0.80877-0.54686 0.90931-0.40288 0.10054-0.81122-0.14355-0.91208-0.54521-0.94136-3.7492-4.3361-6.4261-8.2678-6.4261-3.9334 0-7.3292 2.6792-8.2689 6.4306-0.10063 0.40171-0.50884 0.64603-0.91177 0.54571s-0.648-0.5073-0.54737-0.90901c1.106-4.4152 5.1003-7.5667 9.728-7.5667z</StreamGeometry>
  70. <StreamGeometry x:Key="PasswordBoxHideButtonData">m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z</StreamGeometry>
  71. <MenuFlyout x:Key="DefaultTextBoxContextFlyout" Placement="Bottom">
  72. <MenuItem x:Name="TextBoxContextFlyoutCutItem"
  73. Margin="10,0,0,0"
  74. Command="{Binding $parent[TextBox].Cut}"
  75. Header="Cut"
  76. InputGesture="{x:Static TextBox.CutGesture}"
  77. IsEnabled="{Binding $parent[TextBox].CanCut}" />
  78. <MenuItem x:Name="TextBoxContextFlyoutCopyItem"
  79. Margin="10,0,0,0"
  80. Command="{Binding $parent[TextBox].Copy}"
  81. Header="Copy"
  82. InputGesture="{x:Static TextBox.CopyGesture}"
  83. IsEnabled="{Binding $parent[TextBox].CanCopy}" />
  84. <MenuItem x:Name="TextBoxContextFlyoutPasteItem"
  85. Margin="10,0,0,0"
  86. Command="{Binding $parent[TextBox].Paste}"
  87. Header="Paste"
  88. InputGesture="{x:Static TextBox.PasteGesture}"
  89. IsEnabled="{Binding $parent[TextBox].CanPaste}" />
  90. </MenuFlyout>
  91. <ContextMenu x:Key="DefaultTextBoxContextMenu" x:Name="TextBoxContextMenu">
  92. <MenuItem x:Name="TextBoxContextMenuCutItem"
  93. Margin="10,0,0,0"
  94. Command="{Binding $parent[TextBox].Cut}"
  95. Header="Cut"
  96. InputGesture="{x:Static TextBox.CutGesture}"
  97. IsEnabled="{Binding $parent[TextBox].CanCut}" />
  98. <MenuItem x:Name="TextBoxContextMenuCopyItem"
  99. Margin="10,0,0,0"
  100. Command="{Binding $parent[TextBox].Copy}"
  101. Header="Copy"
  102. InputGesture="{x:Static TextBox.CopyGesture}"
  103. IsEnabled="{Binding $parent[TextBox].CanCopy}" />
  104. <MenuItem x:Name="TextBoxContextMenuPasteItem"
  105. Margin="10,0,0,0"
  106. Command="{Binding $parent[TextBox].Paste}"
  107. Header="Paste"
  108. InputGesture="{x:Static TextBox.PasteGesture}"
  109. IsEnabled="{Binding $parent[TextBox].CanPaste}" />
  110. </ContextMenu>
  111. </Styles.Resources>
  112. <Style Selector="TextBox.FlatTextBox">
  113. <Setter Property="Background" Value="{DynamicResource SukiLightBorderBrush}" />
  114. <Setter Property="BorderBrush" Value="{DynamicResource SukiLightBorderBrush}" />
  115. </Style>
  116. <Style Selector="TextBox.Prefix">
  117. <Setter Property="VerticalContentAlignment" Value="Center" />
  118. <Setter Property="BorderThickness" Value="1.2" />
  119. <Setter Property="BorderBrush" Value="{DynamicResource SukiControlBorderBrush}" />
  120. <Setter Property="CornerRadius" Value="{DynamicResource SmallCornerRadius}" />
  121. <Setter Property="Background" Value="{DynamicResource SukiBackground}" />
  122. <Setter Property="CaretBrush" Value="{DynamicResource ThemeForegroundBrush}" />
  123. <Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
  124. <Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}" />
  125. <Setter Property="Padding" Value="4" />
  126. <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
  127. <Setter Property="Template">
  128. <ControlTemplate>
  129. <Border Padding="5">
  130. <Border Name="border"
  131. Background="{TemplateBinding Background}"
  132. BorderBrush="{TemplateBinding BorderBrush}"
  133. BorderThickness="{TemplateBinding BorderThickness}"
  134. BoxShadow="{DynamicResource SukiLowShadow}"
  135. CornerRadius="{TemplateBinding CornerRadius}">
  136. <Border.Transitions>
  137. <Transitions>
  138. <BrushTransition Property="BorderBrush" Duration="0:0:0.2" />
  139. </Transitions>
  140. </Border.Transitions>
  141. <DockPanel>
  142. <Border Margin="0,0,0,0"
  143. Padding="8,5"
  144. Background="Transparent"
  145. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  146. BorderThickness="0,0,0,0"
  147. CornerRadius="5,0,0,5"
  148. DockPanel.Dock="Left">
  149. <TextBlock HorizontalAlignment="Center"
  150. VerticalAlignment="Center"
  151. Foreground="Gray"
  152. Text="{TemplateBinding Watermark}" />
  153. </Border>
  154. <DockPanel Margin="{TemplateBinding Padding}"
  155. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  156. VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
  157. <TextBlock Name="floatingWatermark"
  158. DockPanel.Dock="Top"
  159. Foreground="{DynamicResource ThemeAccentBrush}"
  160. Text="{TemplateBinding Watermark}">
  161. <TextBlock.IsVisible>
  162. <MultiBinding Converter="{x:Static BoolConverters.And}">
  163. <Binding Path="UseFloatingWatermark" RelativeSource="{RelativeSource TemplatedParent}" />
  164. <Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
  165. Path="Text"
  166. RelativeSource="{RelativeSource TemplatedParent}" />
  167. </MultiBinding>
  168. </TextBlock.IsVisible>
  169. </TextBlock>
  170. <DataValidationErrors>
  171. <Grid ColumnDefinitions="Auto,*,Auto">
  172. <ContentPresenter Grid.Column="0" Content="{TemplateBinding InnerLeftContent}" />
  173. <ScrollViewer Grid.Column="1"
  174. HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
  175. VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
  176. <Panel Margin="0,0,0,0">
  177. <TextBlock Name="watermark"
  178. IsVisible="{TemplateBinding Text,
  179. Converter={x:Static StringConverters.IsNullOrEmpty}}"
  180. Opacity="0.5"
  181. Text="{TemplateBinding Watermark}"
  182. TextAlignment="{TemplateBinding TextAlignment}"
  183. TextWrapping="{TemplateBinding TextWrapping}" />
  184. <TextPresenter Name="PART_TextPresenter"
  185. CaretBrush="{TemplateBinding CaretBrush}"
  186. CaretIndex="{TemplateBinding CaretIndex}"
  187. PasswordChar="{TemplateBinding PasswordChar}"
  188. RevealPassword="{TemplateBinding RevealPassword}"
  189. SelectionBrush="{TemplateBinding SelectionBrush}"
  190. SelectionEnd="{TemplateBinding SelectionEnd}"
  191. SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
  192. SelectionStart="{TemplateBinding SelectionStart}"
  193. Text="{TemplateBinding Text,
  194. Mode=TwoWay}"
  195. TextAlignment="{TemplateBinding TextAlignment}"
  196. TextWrapping="{TemplateBinding TextWrapping}" />
  197. </Panel>
  198. </ScrollViewer>
  199. <ContentPresenter Grid.Column="2" Content="{TemplateBinding InnerRightContent}" />
  200. </Grid>
  201. </DataValidationErrors>
  202. </DockPanel>
  203. </DockPanel>
  204. </Border>
  205. </Border>
  206. </ControlTemplate>
  207. </Setter>
  208. </Style>
  209. <Style Selector="TextBox.Suffix">
  210. <Setter Property="VerticalContentAlignment" Value="Center" />
  211. <Setter Property="BorderThickness" Value="1.2" />
  212. <Setter Property="BorderBrush" Value="{DynamicResource SukiControlBorderBrush}" />
  213. <Setter Property="CornerRadius" Value="{DynamicResource SmallCornerRadius}" />
  214. <Setter Property="Background" Value="{DynamicResource SukiBackground}" />
  215. <Setter Property="CaretBrush" Value="{DynamicResource ThemeForegroundBrush}" />
  216. <Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
  217. <Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}" />
  218. <Setter Property="Padding" Value="4" />
  219. <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
  220. <Setter Property="Template">
  221. <ControlTemplate>
  222. <Border Padding="5">
  223. <Border Name="border"
  224. Background="{TemplateBinding Background}"
  225. BorderBrush="{TemplateBinding BorderBrush}"
  226. BorderThickness="{TemplateBinding BorderThickness}"
  227. BoxShadow="{DynamicResource SukiLowShadow}"
  228. CornerRadius="{TemplateBinding CornerRadius}">
  229. <Border.Transitions>
  230. <Transitions>
  231. <BrushTransition Property="BorderBrush" Duration="0:0:0.2" />
  232. </Transitions>
  233. </Border.Transitions>
  234. <DockPanel>
  235. <Border Margin="0,0,0,0"
  236. Padding="8,5"
  237. Background="Transparent"
  238. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  239. BorderThickness="0,0,0,0"
  240. CornerRadius="0,5,5,0"
  241. DockPanel.Dock="Right">
  242. <TextBlock HorizontalAlignment="Center"
  243. VerticalAlignment="Center"
  244. Foreground="Gray"
  245. Text="{TemplateBinding Watermark}" />
  246. </Border>
  247. <DockPanel Margin="{TemplateBinding Padding}"
  248. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  249. VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
  250. <TextBlock Name="floatingWatermark"
  251. DockPanel.Dock="Top"
  252. Foreground="{DynamicResource ThemeAccentBrush}"
  253. Text="{TemplateBinding Watermark}">
  254. <TextBlock.IsVisible>
  255. <MultiBinding Converter="{x:Static BoolConverters.And}">
  256. <Binding Path="UseFloatingWatermark" RelativeSource="{RelativeSource TemplatedParent}" />
  257. <Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
  258. Path="Text"
  259. RelativeSource="{RelativeSource TemplatedParent}" />
  260. </MultiBinding>
  261. </TextBlock.IsVisible>
  262. </TextBlock>
  263. <DataValidationErrors>
  264. <Grid ColumnDefinitions="Auto,*,Auto">
  265. <ContentPresenter Grid.Column="0" Content="{TemplateBinding InnerLeftContent}" />
  266. <ScrollViewer Grid.Column="1"
  267. HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
  268. VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
  269. <Panel>
  270. <TextBlock Name="watermark"
  271. IsVisible="{TemplateBinding Text,
  272. Converter={x:Static StringConverters.IsNullOrEmpty}}"
  273. Opacity="0.5"
  274. Text="{TemplateBinding Watermark}"
  275. TextAlignment="{TemplateBinding TextAlignment}"
  276. TextWrapping="{TemplateBinding TextWrapping}" />
  277. <TextPresenter Name="PART_TextPresenter"
  278. CaretBrush="{TemplateBinding CaretBrush}"
  279. CaretIndex="{TemplateBinding CaretIndex}"
  280. PasswordChar="{TemplateBinding PasswordChar}"
  281. RevealPassword="{TemplateBinding RevealPassword}"
  282. SelectionBrush="{TemplateBinding SelectionBrush}"
  283. SelectionEnd="{TemplateBinding SelectionEnd}"
  284. SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
  285. SelectionStart="{TemplateBinding SelectionStart}"
  286. Text="{TemplateBinding Text,
  287. Mode=TwoWay}"
  288. TextAlignment="{TemplateBinding TextAlignment}"
  289. TextWrapping="{TemplateBinding TextWrapping}" />
  290. </Panel>
  291. </ScrollViewer>
  292. <ContentPresenter Grid.Column="2" Content="{TemplateBinding InnerRightContent}" />
  293. </Grid>
  294. </DataValidationErrors>
  295. </DockPanel>
  296. </DockPanel>
  297. </Border>
  298. </Border>
  299. </ControlTemplate>
  300. </Setter>
  301. </Style>
  302. <Style Selector="TextBox">
  303. <Setter Property="VerticalContentAlignment" Value="Center" />
  304. <Setter Property="BorderThickness" Value="1" />
  305. <Setter Property="FontSize" Value="14" />
  306. <Setter Property="BorderBrush" Value="{DynamicResource SukiControlBorderBrush}" />
  307. <Setter Property="CornerRadius" Value="{DynamicResource SmallCornerRadius}" />
  308. <Setter Property="Background" Value="{DynamicResource SukiBackground}" />
  309. <Setter Property="Foreground" Value="{DynamicResource SukiText}" />
  310. <Setter Property="SelectionBrush" Value="{DynamicResource SukiPrimaryColor75}" />
  311. <Setter Property="MinHeight" Value="45" />
  312. <Setter Property="Padding" Value="6,8,5,6" />
  313. <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
  314. <Setter Property="Template">
  315. <ControlTemplate>
  316. <Border Padding="5">
  317. <Border.Resources>
  318. <theme:StringToDoubleConverter x:Key="StringToDoubleC" />
  319. </Border.Resources>
  320. <Panel>
  321. <suki:GlassCard Name="border"
  322. Padding="0"
  323. BorderBrush="{TemplateBinding BorderBrush}"
  324. BorderThickness="{TemplateBinding BorderThickness}"
  325. Classes="Discrete"
  326. CornerRadius="{TemplateBinding CornerRadius}">
  327. <suki:GlassCard.Transitions>
  328. <Transitions>
  329. <BrushTransition Property="BorderBrush" Duration="0:0:0.2" />
  330. </Transitions>
  331. </suki:GlassCard.Transitions>
  332. </suki:GlassCard>
  333. <Border Name="borderbottom"
  334. Margin="1,-1,1,-1"
  335. BorderBrush="{TemplateBinding BorderBrush}"
  336. BorderThickness="0"
  337. ClipToBounds="True"
  338. CornerRadius="1">
  339. <Border.Transitions>
  340. <Transitions>
  341. <BrushTransition Property="BorderBrush" Duration="0:0:0.2" />
  342. </Transitions>
  343. </Border.Transitions>
  344. <DockPanel Margin="{TemplateBinding Padding}"
  345. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  346. VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
  347. <TextBlock Name="floatingWatermark"
  348. DockPanel.Dock="Top"
  349. Text="{TemplateBinding Watermark}">
  350. <TextBlock.IsVisible>
  351. <MultiBinding Converter="{x:Static BoolConverters.And}">
  352. <Binding Path="UseFloatingWatermark" RelativeSource="{RelativeSource TemplatedParent}" />
  353. <Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
  354. Path="Text"
  355. RelativeSource="{RelativeSource TemplatedParent}" />
  356. </MultiBinding>
  357. </TextBlock.IsVisible>
  358. </TextBlock>
  359. <DataValidationErrors>
  360. <Grid ColumnDefinitions="Auto,*,Auto">
  361. <Panel>
  362. <TextBlock Margin="3,1,3,0"
  363. FontSize="14"
  364. Foreground="{DynamicResource SukiLowText}"
  365. Text="{TemplateBinding theme:TextBoxExtensions.Prefix}" />
  366. </Panel>
  367. <ScrollViewer Grid.Column="1"
  368. HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
  369. VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
  370. <Panel>
  371. <TextBlock Name="watermark"
  372. FontSize="{TemplateBinding FontSize}"
  373. IsVisible="{TemplateBinding Text,
  374. Converter={x:Static StringConverters.IsNullOrEmpty}}"
  375. Opacity="0.5"
  376. Text="{TemplateBinding Watermark}"
  377. TextAlignment="{TemplateBinding TextAlignment}"
  378. TextWrapping="{TemplateBinding TextWrapping}" />
  379. <TextPresenter Name="PART_TextPresenter"
  380. Margin="0,0,0,0"
  381. CaretBrush="{DynamicResource SukiLowText}"
  382. CaretIndex="{TemplateBinding CaretIndex}"
  383. PasswordChar="{TemplateBinding PasswordChar}"
  384. RevealPassword="{TemplateBinding RevealPassword}"
  385. SelectionBrush="{TemplateBinding SelectionBrush}"
  386. SelectionEnd="{TemplateBinding SelectionEnd}"
  387. SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
  388. SelectionStart="{TemplateBinding SelectionStart}"
  389. Text="{TemplateBinding Text,
  390. Mode=TwoWay}"
  391. TextAlignment="{TemplateBinding TextAlignment}"
  392. TextBlock.FontSize="{TemplateBinding FontSize}"
  393. TextBlock.Foreground="{TemplateBinding Foreground}"
  394. TextWrapping="{TemplateBinding TextWrapping}" />
  395. </Panel>
  396. </ScrollViewer>
  397. <theme:TextEraserButton Grid.Column="2"
  398. Margin="5,0,0,0"
  399. Cursor="Hand"
  400. IsVisible="{TemplateBinding theme:TextBoxExtensions.AddDeleteButton}"
  401. Opacity="{TemplateBinding Text,
  402. Converter={StaticResource StringToDoubleC}}"
  403. Text="{TemplateBinding Text,
  404. Mode=TwoWay}">
  405. <theme:TextEraserButton.Transitions>
  406. <Transitions>
  407. <DoubleTransition Property="Opacity" Duration="0:0:0.35" />
  408. </Transitions>
  409. </theme:TextEraserButton.Transitions>
  410. </theme:TextEraserButton>
  411. </Grid>
  412. </DataValidationErrors>
  413. </DockPanel>
  414. </Border>
  415. </Panel>
  416. </Border>
  417. </ControlTemplate>
  418. </Setter>
  419. </Style>
  420. <Style Selector="TextBox:pointerover /template/ suki|GlassCard#border">
  421. <Setter Property="BorderBrush" Value="{DynamicResource SukiBorderBrush}" />
  422. </Style>
  423. <Style Selector="TextBox.FlatTextBox /template/ suki|GlassCard#border">
  424. <Setter Property="BorderThickness" Value="0" />
  425. <Setter Property="ClipToBounds" Value="True" />
  426. </Style>
  427. <Style Selector="TextBox:pointerover /template/ Border#borderbottom">
  428. <Setter Property="BorderBrush" Value="{DynamicResource SukiBorderBrush}" />
  429. </Style>
  430. <Style Selector="TextBox.BottomBar /template/ Border#borderbottom">
  431. <Setter Property="BorderThickness" Value="0,0,0,1.5" />
  432. </Style>
  433. <Style Selector="TextBox:focus /template/ Border#borderbottom">
  434. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  435. </Style>
  436. <Style Selector="TextBox:focus /template/ suki|GlassCard#border">
  437. <Setter Property="BorderBrush" Value="{DynamicResource SukiPrimaryColor}" />
  438. <Setter Property="BorderThickness" Value="1.2" />
  439. </Style>
  440. <Style Selector="TextBox:error /template/ suki|GlassCard#border">
  441. <Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" />
  442. </Style>
  443. <Style Selector="TextBox /template/ DockPanel">
  444. <Setter Property="Cursor" Value="IBeam" />
  445. </Style>
  446. <Style Selector="TextBox:disabled /template/ suki|GlassCard#border">
  447. <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
  448. </Style>
  449. <Style Selector="TextBox:disabled">
  450. <Setter Property="Foreground" Value="{DynamicResource SukiDisabledText}" />
  451. </Style>
  452. <Style Selector="TextBox.clearButton[AcceptsReturn=False][IsReadOnly=False]:focus:not(TextBox:empty)">
  453. <Setter Property="InnerRightContent">
  454. <Template>
  455. <Button Classes="textBoxClearButton" Command="{Binding $parent[TextBox].Clear}" />
  456. </Template>
  457. </Setter>
  458. </Style>
  459. <Style Selector="Button.textBoxClearButton">
  460. <Setter Property="Cursor" Value="Arrow" />
  461. <Setter Property="Template">
  462. <Setter.Value>
  463. <ControlTemplate TargetType="Button">
  464. <Border x:Name="PART_ButtonLayoutBorder"
  465. Background="Transparent"
  466. BorderThickness="{TemplateBinding BorderThickness}">
  467. <Path x:Name="PART_GlyphElement"
  468. Width="10"
  469. Height="10"
  470. HorizontalAlignment="Center"
  471. VerticalAlignment="Center"
  472. Data="{StaticResource TextBoxClearButtonData}"
  473. Fill="{DynamicResource ThemeForegroundColor}"
  474. Stretch="Uniform" />
  475. </Border>
  476. </ControlTemplate>
  477. </Setter.Value>
  478. </Setter>
  479. </Style>
  480. <Style Selector="TextBox.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
  481. <Setter Property="InnerRightContent">
  482. <Template>
  483. <Panel Margin="4,0">
  484. <Panel.Styles>
  485. <Style Selector="ToggleButton[IsChecked=True]">
  486. <Setter Property="(ToolTip.Tip)" Value="Hide Password" />
  487. </Style>
  488. <Style Selector="ToggleButton[IsChecked=False]">
  489. <Setter Property="(ToolTip.Tip)" Value="Show Password" />
  490. </Style>
  491. </Panel.Styles>
  492. <ToggleButton Background="Transparent"
  493. Classes="passwordBoxRevealButton"
  494. IsChecked="{Binding $parent[TextBox].RevealPassword, Mode=TwoWay}" />
  495. </Panel>
  496. </Template>
  497. </Setter>
  498. </Style>
  499. <Style Selector="ToggleButton.passwordBoxRevealButton">
  500. <Setter Property="Cursor" Value="Arrow" />
  501. <Setter Property="Template">
  502. <Setter.Value>
  503. <ControlTemplate TargetType="ToggleButton">
  504. <Border x:Name="PART_ButtonLayoutBorder"
  505. Width="12"
  506. Background="Transparent">
  507. <Panel>
  508. <Path x:Name="PART_GlyphElement_Reveal"
  509. Width="12"
  510. Height="8"
  511. HorizontalAlignment="Center"
  512. VerticalAlignment="Center"
  513. Data="{DynamicResource PasswordBoxRevealButtonData}"
  514. Fill="{DynamicResource ThemeForegroundColor}"
  515. Stretch="Uniform" />
  516. <Path x:Name="PART_GlyphElement_Hide"
  517. Width="12"
  518. Height="12"
  519. HorizontalAlignment="Center"
  520. VerticalAlignment="Center"
  521. Data="{DynamicResource PasswordBoxHideButtonData}"
  522. Fill="{DynamicResource ThemeForegroundColor}"
  523. Stretch="Uniform" />
  524. </Panel>
  525. </Border>
  526. </ControlTemplate>
  527. </Setter.Value>
  528. </Setter>
  529. </Style>
  530. <Style Selector="ToggleButton.passwordBoxRevealButton:not(ToggleButton:checked) /template/ Path#PART_GlyphElement_Hide">
  531. <Setter Property="IsVisible" Value="False" />
  532. </Style>
  533. <Style Selector="ToggleButton.passwordBoxRevealButton:checked /template/ Path#PART_GlyphElement_Reveal">
  534. <Setter Property="IsVisible" Value="False" />
  535. </Style>
  536. <Style Selector="Button.textBoxClearButton, ToggleButton.passwordBoxRevealButton">
  537. <Setter Property="Focusable" Value="False" />
  538. </Style>
  539. <Style Selector="TextBox.NoShadow /template/ Border">
  540. <Setter Property="BoxShadow" Value="0 0 0 0 Gray" />
  541. </Style>
  542. <Style Selector="TextBox.NoShadow /template/ suki|GlassCard#border">
  543. <Setter Property="Background" Value="Transparent" />
  544. <Setter Property="BorderThickness" Value="0" />
  545. <Setter Property="IsVisible" Value="False" />
  546. </Style>
  547. <Style Selector="TextBox.NoShadow:focus /template/ suki|GlassCard#border">
  548. <Setter Property="Background" Value="Transparent" />
  549. <Setter Property="BorderThickness" Value="0" />
  550. </Style>
  551. </Styles>