Hello,
In my controls (TextBox, ComboBox, MaskedBox), i set Background="#FF333333". In the TextBox the cursor change to white, but the XamMaskedBox the cursor stays Black. How can i change this color?
Thank you!
Excuse me for the late reply I suppose you probably have already solved this. Nevertheless I looked in to your xaml snippet and think have found the source of your troubles. Usually when retemplating our controls we suggest you use the original template in the DefaultStyles folder in order to not lose any of the original functionality. In your scenario I can see you have almost done this, but I think the issue lies in you using the same template for both the Template and the EditorTemaplate properties. If I am not mistaken you have used the part from our default style which is used outside EditMode for both your states. In it there is no caret since there is no editing.
Hope this helps. Please let me know if I can assist you further on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Hello Pettar Monov,
I tried to do a new style, because i wanted to put a Border with CornerRaius=3. Now i can't set this solution, and the CaretElement does not appear, neither black nor white.
XAML:
<ControlTemplate x:Key="XamMaskedEditorTemplate" TargetType="{x:Type igEditors:XamMaskedEditor}"> <ControlTemplate.Resources> <Storyboard x:Key="HoverOn"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.5" /> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="HoverOff"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="FocusedOn"> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1" /> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="FocusedOff"> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"> <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Border x:Name="MainBorder" CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"> <DockPanel> <Grid x:Name="PART_SpinButtons" Margin="0,1" Visibility="{TemplateBinding SpinButtonVisibilityResolved}" DockPanel.Dock="Right"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="1"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <RepeatButton Style="{TemplateBinding SpinButtonStyle}" ContentTemplate="{DynamicResource EditorsBrushKeys.IncreaseGlyphKey}" Focusable="False" IsHitTestVisible="False"/> <RepeatButton Style="{TemplateBinding SpinButtonStyle}" ContentTemplate="{DynamicResource EditorsBrushKeys.DecreaseGlyphKey}" Focusable="False" IsHitTestVisible="False" Grid.Row="2"/> </Grid> <TextBlock x:Name="TextBlock" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Text="{TemplateBinding DisplayText}"/> </DockPanel> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEmbedded" Value="False"> <Setter Property="Padding" Value="4,2"/> </Trigger> <Trigger Property="Validation.HasError" Value="True"> <Setter Property="ToolTip"> <Setter.Value> <Binding Path="(Validation.Errors)[0].ErrorContent" RelativeSource="{x:Static RelativeSource.Self}"/> </Setter.Value> </Setter> <Setter Property="BorderBrush" Value="Red"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="{x:Type igEditors:XamMaskedEditor}"> <Setter Property="KeyboardNavigation.TabNavigation" Value="None" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="AllowDrop" Value="true" /> <Setter Property="Template" Value="{DynamicResource XamMaskedEditorTemplate}" /> <Setter Property="EditTemplate" Value="{DynamicResource XamMaskedEditorTemplate}" /> <Setter Property="Foreground" Value="Black" /> <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/> <Setter Property="BorderBrush" Value="#FF000000"/> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="Margin" Value="0,2,40,2" /> <Setter Property="Margin" Value="4,4,10,4" /> </Style>
Is it correct?
Thank You
I have been looking into your issue and have found a way for you to achieve your goal. You can create a style for the CaretElement and set it inside the XamMskedEditor like so:
<igEditors:XamMaskedEditor x:Name="xamMaskedEditor1"
Background="Black"
Foreground="White"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="100" >
<igEditors:XamMaskedEditor.Resources>
<Style TargetType="{x:Type igEditors:CaretElement}">
<Setter Property="Background" Value="White" />
<Setter Property="Width" Value="1" />
</Style>
</igEditors:XamMaskedEditor.Resources>
</igEditors:XamMaskedEditor>
Please let me know if you require any further assistance on the matter.