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
370
XamMaskedEditor style round
posted

When I apply this style to XamMaskedEditor I can not see the field value
if within the focus of the field I can see the value but lose the style
there is someone that I can 'help

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" xmlns:igEditors="http://infragistics.com/Editors">
    <Window.Resources >

        <Style x:Key="roundTextBox" TargetType="{x:Type igEditors:XamMaskedEditor }">

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igEditors:XamMaskedEditor }">
                        <Grid>
                            <Border x:Name="BorderBase" Background="White" BorderThickness="1.4,1.4,1,1"
                            BorderBrush="Silver" CornerRadius="10" />
                            <Label x:Name="TextPrompt" Content="{TemplateBinding Tag}" Visibility="Collapsed" Focusable="False"  Foreground="Silver"></Label>
                           
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsFocused" Value="False"></Condition>
                                    <Condition Property="Text" Value=""></Condition>
                                </MultiTrigger.Conditions>
                                <MultiTrigger.Setters>
                                    <Setter Property="Visibility" TargetName="TextPrompt" Value="Visible"></Setter>
                                </MultiTrigger.Setters>
                            </MultiTrigger>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="BorderThickness" TargetName="BorderBase" Value="2.4,2.4,1,1"></Setter>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Foreground" Value="DimGray" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <TextBox Height="29" HorizontalAlignment="Left" Margin="91,91,0,0" Name="TextBox1" VerticalAlignment="Top" Width="113" Text="ciao" AcceptsReturn="True"  />
        <igEditors:XamMaskedEditor Height="24" HorizontalAlignment="Left" Margin="73,157,0,0" Name="XamMaskedEditor1" VerticalAlignment="Top" Width="163"  Value="TEST WPF" UseLayoutRounding="False" Style="{StaticResource roundTextBox}"  IsHitTestVisible="True" SnapsToDevicePixels="True"   />
    </Grid>
</Window>

Parents
No Data
Reply
  • 9836
    Suggested Answer
    posted

    In your case you are binding the Content of the Label to the Tag property of the XamMaskedEditor which is not set. You can either set Tag to the masked editor or better bind the Content to the DisplayText property of the editor:

    <

     

     

    Label x:Name="TextBlock" Content="{TemplateBinding DisplayText}" Visibility="Collapsed" Focusable="False" Foreground="Silver"/>

    Let me know if that solves the issue.

Children