Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:s="clr-namespace:System;assembly=mscorlib"
  4. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  5. xmlns:local="clr-namespace:Downloader.App.ResourceDictionaries.NamedStyles">
  6.  
  7. <Style x:Key="TextBoxWithDefaultTextStyle" TargetType="TextBox">
  8.  
  9. <!--Padding for typed text-->
  10. <Setter Property="Padding" Value="5, 2, 5, 0"/>
  11. <Setter Property="Background" Value="White" />
  12. <Setter Property="BorderBrush" Value="#FF858585" />
  13. <Setter Property="BorderThickness" Value="3" />
  14. <Setter Property="Border.CornerRadius" Value="10" />
  15. <Setter Property="Control.Template" Value="{StaticResource TextBoxBaseControlTemplate}"></Setter>
  16.  
  17. <Style.Triggers>
  18. <Trigger Property="Validation.HasError" Value="True">
  19.  
  20. <Setter Property="Validation.ErrorTemplate">
  21. <Setter.Value>
  22. <ControlTemplate>
  23. <DockPanel>
  24. <Border BorderBrush="Brown" BorderThickness="5"
  25. CornerRadius="2">
  26.  
  27. <AdornedElementPlaceholder x:Name="controlWithError"/>
  28. </Border>
  29. <TextBlock Foreground="Red" FontSize="20" FontFamily="Segoe UI" Margin="3,0,0,0">!</TextBlock>
  30. </DockPanel>
  31. <ControlTemplate.Triggers>
  32. <Trigger Property="Validation.HasError" Value="true">
  33. <Setter Property="Background" Value="Red"/>
  34. <Setter Property="Foreground" Value="White"/>
  35. </Trigger>
  36. </ControlTemplate.Triggers>
  37. </ControlTemplate>
  38. </Setter.Value>
  39. </Setter>
  40.  
  41. </Trigger>
  42. </Style.Triggers>
  43. </Style>
  44. </ResourceDictionary>
  45.  
  46. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  47. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  48. xmlns:s="clr-namespace:System;assembly=mscorlib"
  49. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  50. xmlns:local="clr-namespace:Downloader.App.ResourceDictionaries.NamedStyles">
  51.  
  52. <Style x:Key="TextBoxWithDefaultTextStyle" TargetType="TextBox">
  53.  
  54. <!--Padding for typed text-->
  55. <Setter Property="Padding" Value="5, 2, 5, 0"/>
  56. <Setter Property="Background" Value="White" />
  57. <Setter Property="BorderBrush" Value="#FF858585" />
  58. <Setter Property="BorderThickness" Value="3" />
  59. <Setter Property="Border.CornerRadius" Value="10" />
  60. <Setter Property="Control.Template" Value="{StaticResource TextBoxBaseControlTemplate}"></Setter>
  61. <Setter Property="Validation.ErrorTemplate" Value="{StaticResource TextBoxValidationTemplate}"></Setter>
  62. </Style>
  63. </ResourceDictionary>
  64.  
  65. <AdornedElementPlaceholder x:Name="controlWithError"/>
  66. </Border>
  67. <TextBlock Foreground="Red" FontSize="20" FontFamily="Segoe UI" Margin="3,0,0,0">!</TextBlock>
  68. </DockPanel>
  69. <ControlTemplate.Triggers>
  70. <Trigger Property="Validation.HasError" Value="true">
  71. <Setter Property="Background" Value="Red"/>
  72. <Setter Property="Foreground" Value="White"/>
  73. </Trigger>
  74. </ControlTemplate.Triggers>
  75. </ControlTemplate>
  76.  
  77. <TextBox Text="{Binding UserName, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"
  78. Validation.ErrorTemplate="{StaticResource TextBoxValidationTemplate}"
  79. Style="{StaticResource TextBoxWithDefaultTextStyle}"
  80. Grid.Row="2"
  81. Grid.Column="0"
  82. Margin="5,2,5,2"
  83. Grid.ColumnSpan="2"/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement