Mercurial > silverbladetech
changeset 53:f5c13b2b0149
Updated to orange
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Thu, 19 Apr 2012 12:07:54 +0100 |
parents | 6235c5f0d9db |
children | cd9faa9f024b |
files | SilverlightValidation/SilverlightValidation/App.xaml SilverlightValidation/SilverlightValidation/UserView.xaml SilverlightValidation/SilverlightValidation/UserViewModel.cs |
diffstat | 3 files changed, 355 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/SilverlightValidation/SilverlightValidation/App.xaml Thu Apr 19 11:45:38 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation/App.xaml Thu Apr 19 12:07:54 2012 +0100 @@ -14,7 +14,7 @@ <TranslateTransform x:Name="xform" X="-25" /> </Grid.RenderTransform> <VisualStateManager.VisualStateGroups> - <VisualStateGroup Name="OpenStates"> + <VisualStateGroup x:Name="OpenStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0" /> <VisualTransition GeneratedDuration="0:0:0.2" To="Open"> @@ -56,7 +56,6 @@ </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> - <Border Margin="4,4,-4,-4" Background="#052A2E31" CornerRadius="5" /> @@ -69,8 +68,7 @@ <Border Margin="1,1,-1,-1" Background="#352A2E31" CornerRadius="2" /> - - <Border Background="#FFDC000C" CornerRadius="2" /> + <Border Background="#FFF3AB00" CornerRadius="2" /> <Border CornerRadius="2"> <TextBlock MaxWidth="250" Margin="8,4,8,4" @@ -90,17 +88,187 @@ </Style> <Style x:Key="TextBoxStyle" TargetType="TextBox"> + <Setter Property="BorderThickness" Value="1" /> + <Setter Property="Background" Value="#FFFFFFFF" /> <Setter Property="FontFamily" Value="Segoe UI Light" /> <Setter Property="FontSize" Value="12" /> <Setter Property="Height" Value="24" /> <Setter Property="VerticalAlignment" Value="Center" /> - </Style> - - <Style x:Key="PasswordBoxStyle" TargetType="PasswordBox"> - <Setter Property="FontFamily" Value="Segoe UI Light" /> - <Setter Property="FontSize" Value="12" /> - <Setter Property="Height" Value="24" /> - <Setter Property="VerticalAlignment" Value="Center" /> + <Setter Property="Foreground" Value="#FF000000" /> + <Setter Property="Padding" Value="2" /> + <Setter Property="BorderBrush"> + <Setter.Value> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Offset="0" Color="#FFA3AEB9" /> + <GradientStop Offset="0.375" Color="#FF8399A9" /> + <GradientStop Offset="0.375" Color="#FF718597" /> + <GradientStop Offset="1" Color="#FF617584" /> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="TextBox"> + <Grid x:Name="RootElement"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal" /> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ColorAnimation Duration="0" + Storyboard.TargetName="MouseOverBorder" + Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" + To="#FF99C1E2" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="DisabledVisualElement" + Storyboard.TargetProperty="Opacity" + To="1" /> + </Storyboard> + </VisualState> + <VisualState x:Name="ReadOnly"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="ReadOnlyVisualElement" + Storyboard.TargetProperty="Opacity" + To="1" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="FocusVisualElement" + Storyboard.TargetProperty="Opacity" + To="1" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="FocusVisualElement" + Storyboard.TargetProperty="Opacity" + To="0" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="ValidationStates"> + <VisualState x:Name="Valid" /> + <VisualState x:Name="InvalidUnfocused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="InvalidFocused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <s:Boolean>True</s:Boolean> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="Border" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="1" + Opacity="1"> + <Grid> + <Border x:Name="ReadOnlyVisualElement" + Background="#5EC9C9C9" + Opacity="0" /> + <Border x:Name="MouseOverBorder" + BorderBrush="Transparent" + BorderThickness="1"> + <ScrollViewer x:Name="ContentElement" + BorderThickness="0" + IsTabStop="False" + Padding="{TemplateBinding Padding}" /> + </Border> + </Grid> + </Border> + <Border x:Name="DisabledVisualElement" + Background="#A5F7F7F7" + BorderBrush="#A5F7F7F7" + BorderThickness="{TemplateBinding BorderThickness}" + IsHitTestVisible="False" + Opacity="0" /> + <Border x:Name="FocusVisualElement" + Margin="1" + BorderBrush="#FF6DBDD1" + BorderThickness="{TemplateBinding BorderThickness}" + IsHitTestVisible="False" + Opacity="0" /> + <Border x:Name="ValidationErrorElement" + BorderBrush="#FFF3AB00" + BorderThickness="1" + CornerRadius="1" + Visibility="Collapsed"> + <ToolTipService.ToolTip> + <ToolTip x:Name="validationTooltip" + DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" + Placement="Right" + PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" + Template="{StaticResource ValidationToolTipTemplate}"> + <ToolTip.Triggers> + <EventTrigger RoutedEvent="Canvas.Loaded"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <s:Boolean>true</s:Boolean> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </ToolTip.Triggers> + </ToolTip> + </ToolTipService.ToolTip> + <Grid Width="12" + Height="12" + Margin="1,-4,-4,0" + HorizontalAlignment="Right" + VerticalAlignment="Top" + Background="Transparent"> + <Path Margin="1,3,0,0" + Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" + Fill="#FFF3AB00" /> + <Path Margin="1,3,0,0" + Data="M 0,0 L2,0 L 8,6 L8,8" + Fill="#ffffff" /> + </Grid> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> </Style> <Style x:Key="DatePickerStyle" TargetType="sdk:DatePicker"> @@ -403,7 +571,7 @@ </Grid> <Popup x:Name="Popup" /> <Border x:Name="ValidationErrorElement" - BorderBrush="#FFDB000C" + BorderBrush="#FFF3AB00" BorderThickness="1" CornerRadius="1" Visibility="Collapsed"> @@ -438,7 +606,7 @@ Background="Transparent"> <Path Margin="1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" - Fill="#FFDC000C" /> + Fill="#FFF3AB00" /> <Path Margin="1,3,0,0" Data="M 0,0 L2,0 L 8,6 L8,8" Fill="#ffffff" /> @@ -456,6 +624,7 @@ <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="Width" Value="60" /> </Style> + <Style x:Key="ValidationSummaryStyle" TargetType="sdk:ValidationSummary"> <Setter Property="IsTabStop" Value="False" /> <Setter Property="Background" Value="#FFEFEFEA" /> @@ -468,7 +637,7 @@ <DataTemplate> <Border x:Name="Header" Margin="-1,-1,-1,0" - Background="#FFDC020D" + Background="#FFF3AB00" CornerRadius="2"> <StackPanel Margin="6,2,6,4" VerticalAlignment="Top" @@ -483,7 +652,7 @@ </Ellipse.Fill> <Ellipse.Stroke> <LinearGradientBrush StartPoint="0.505,0.65" EndPoint="0.5,0.058"> - <GradientStop Offset="0" Color="#FFCA000C" /> + <GradientStop Offset="0" Color="#FFF3AB00" /> <GradientStop Offset="0.991" Color="#FFFF9298" /> </LinearGradientBrush> </Ellipse.Stroke> @@ -658,5 +827,171 @@ </Setter.Value> </Setter> </Style> + + <Style x:Key="PasswordBoxStyle" TargetType="PasswordBox"> + <Setter Property="FontFamily" Value="Segoe UI Light" /> + <Setter Property="FontSize" Value="12" /> + <Setter Property="Height" Value="24" /> + <Setter Property="VerticalAlignment" Value="Center" /> + <Setter Property="BorderThickness" Value="1" /> + <Setter Property="Background" Value="#FFFFFFFF" /> + <Setter Property="Foreground" Value="#FF000000" /> + <Setter Property="Padding" Value="2" /> + <Setter Property="BorderBrush"> + <Setter.Value> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Offset="0" Color="#FFA3AEB9" /> + <GradientStop Offset="0.375" Color="#FF8399A9" /> + <GradientStop Offset="0.375" Color="#FF718597" /> + <GradientStop Offset="1" Color="#FF617584" /> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="PasswordBox"> + <Grid x:Name="RootElement"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal" /> + <VisualState x:Name="MouseOver"> + <Storyboard> + <ColorAnimation Duration="0" + Storyboard.TargetName="MouseOverBorder" + Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" + To="#FF99C1E2" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="DisabledVisualElement" + Storyboard.TargetProperty="Opacity" + To="1" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="FocusVisualElement" + Storyboard.TargetProperty="Opacity" + To="1" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"> + <Storyboard> + <DoubleAnimation Duration="0" + Storyboard.TargetName="FocusVisualElement" + Storyboard.TargetProperty="Opacity" + To="0" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="ValidationStates"> + <VisualState x:Name="Valid" /> + <VisualState x:Name="InvalidUnfocused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="InvalidFocused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <s:Boolean>True</s:Boolean> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Border x:Name="Border" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="1" + Opacity="1"> + <Border x:Name="MouseOverBorder" + BorderBrush="Transparent" + BorderThickness="1"> + <Border x:Name="ContentElement" Margin="{TemplateBinding Padding}" /> + </Border> + </Border> + <Border x:Name="DisabledVisualElement" + Background="#A5F7F7F7" + BorderBrush="#A5F7F7F7" + BorderThickness="{TemplateBinding BorderThickness}" + IsHitTestVisible="False" + Opacity="0" /> + <Border x:Name="FocusVisualElement" + Margin="1" + BorderBrush="#FF6DBDD1" + BorderThickness="{TemplateBinding BorderThickness}" + IsHitTestVisible="False" + Opacity="0" /> + <Border x:Name="ValidationErrorElement" + BorderBrush="#FFF3AB00" + BorderThickness="1" + CornerRadius="1" + Visibility="Collapsed"> + <ToolTipService.ToolTip> + <ToolTip x:Name="validationTooltip" + DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" + Placement="Right" + PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" + Template="{StaticResource ValidationToolTipTemplate}"> + <ToolTip.Triggers> + <EventTrigger RoutedEvent="Canvas.Loaded"> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible"> + <DiscreteObjectKeyFrame KeyTime="0"> + <DiscreteObjectKeyFrame.Value> + <s:Boolean>true</s:Boolean> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </EventTrigger> + </ToolTip.Triggers> + </ToolTip> + </ToolTipService.ToolTip> + <Grid Width="12" + Height="12" + Margin="1,-4,-4,0" + HorizontalAlignment="Right" + VerticalAlignment="Top" + Background="Transparent"> + <Path Margin="1,3,0,0" + Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" + Fill="#FFF3AB00" /> + <Path Margin="1,3,0,0" + Data="M 0,0 L2,0 L 8,6 L8,8" + Fill="#ffffff" /> + </Grid> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> </Application.Resources> </Application>
--- a/SilverlightValidation/SilverlightValidation/UserView.xaml Thu Apr 19 11:45:38 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation/UserView.xaml Thu Apr 19 12:07:54 2012 +0100 @@ -63,7 +63,8 @@ Password="{Binding Password, Mode=TwoWay, ValidatesOnDataErrors=True, - NotifyOnValidationError=True}" /> + NotifyOnValidationError=True}" + Style="{StaticResource PasswordBoxStyle}" /> <sdk:DescriptionViewer Grid.Row="2" Grid.Column="3" @@ -144,7 +145,8 @@ <sdk:ValidationSummary Grid.Row="7" Grid.Column="1" - Grid.ColumnSpan="2" /> + Grid.ColumnSpan="2" + Style="{StaticResource ValidationSummaryStyle}" /> </Grid> </UserControl>
--- a/SilverlightValidation/SilverlightValidation/UserViewModel.cs Thu Apr 19 11:45:38 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation/UserViewModel.cs Thu Apr 19 12:07:54 2012 +0100 @@ -193,9 +193,9 @@ public void CancelChanges() { + ClearAllErrors(); if (!IsChanged) return; SetProperties(_backup); - ClearAllErrors(); IsChanged = false; }