Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1160
Styling the xamMaskedEditor
posted

Hi,

I need to style up the xamMaskedEditor to be consistent with the styling of textboxes with our app.  It must have a BorderThickness="2" with a CornerRadius="5".  On IsMouseOver we want to change the color of the border and to a different color when the control IsFocused as well as manipulate change the foreground and background colors when the control is disabled.  I've looked at the DefaultStyles it appears that the control consists of 2 parts that I need to be concerned with:Template and the EditTemplate.  Do I need to re-define the ControlTemplates for both of these areas or is there a simpler way to do this?  Below is some of the xaml that re-defines the TextBox.

Thanks!

Glenn

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<ControlTemplate TargetType="{x:Type TextBox

}">

 

 

 

<!--<myluna:SystemDropShadowChrome Margin="6">-->

 

 

 

<Border CornerRadius

="5"

 

 

SnapsToDevicePixels

="true"

 

 

x:Name

="Bd"

 

 

Background="{TemplateBinding Background

}"

 

 

BorderBrush="{TemplateBinding BorderBrush

}"

 

 

BorderThickness="{TemplateBinding BorderThickness

}">

 

 

 

<ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name

="PART_ContentHost"/>

 

 

 

</Border

>

 

 

 

<!--</myluna:SystemDropShadowChrome>-->

 

 

 

<ControlTemplate.Triggers

>

 

 

 

<Trigger Property="IsReadOnly" Value

="true">

 

 

 

<Setter Property="Background" TargetName="Bd" Value="{DynamicResource DisabledBackgroundBrush

}" />

 

 

 

<!-- Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/> -->

 

 

 

</Trigger

>

 

 

 

<Trigger Property="IsEnabled" Value

="False">

 

 

 

<Setter Property="Panel.Background" TargetName="Bd" Value="{DynamicResource DisabledBackgroundBrush

}" />

 

 

 

<!-- Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />-->

 

 

 

<Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey

}}"/>

 

 

 

</Trigger

>

 

 

 

<Trigger Property="IsMouseOver" Value

="True">

 

 

 

<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource FieldHoverBrush

}" />

 

 

 

<Setter Property="BorderThickness" TargetName="Bd" Value

="2,2,2,2" />

 

 

 

<Setter Property="Background" TargetName="Bd" Value

="White" />

 

 

 

</Trigger

>

 

 

 

<Trigger Property="IsFocused" Value

="True">

 

 

 

<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource FieldFocusBrush

}"/>

 

 

 

<Setter Property="Background" TargetName="Bd" Value

="White" />

 

 

 

<Setter Property="BorderThickness" TargetName="Bd" Value

="2,2,2,2" />

 

 

 

</Trigger

>

 

 

 

<!--<Trigger Property="IsKeyboardFocusWithin" Value="True">

<Setter Property="Background" Value="{DynamicResource FieldFocusBrush}"/>

<Setter Property="Background" TargetName="Bd" Value="White" />

<Setter Property="BorderThickness" TargetName="Bd" Value="2,2,2,2" />

</Trigger>-->

 

 

 

 

</ControlTemplate.Triggers

>

 

 

 

</ControlTemplate

>