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
905
Managing mandatory fields with triggers
posted

I would like to set mandatory field backgrounds are red and others are green. So I try to implement below. But I could not control ValueConstraint Nullable property with trigger. Could you help please ?

<Window x:Class="TriggerGirilmesigerekenalanlar.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:y="http://infragistics.com/Editors" 
    Title="Window1" Height="300" Width="300"> 
    <Window.Resources> 
        <Style TargetType="{x:Type y:XamTextEditor}"> 
            <Style.Triggers> 
                <Trigger Property="ValueConstraint" Value="{x:Null}"> 
                    <Trigger.Setters> 
                        <Setter Property="Background" Value="green"></Setter> 
                    </Trigger.Setters> 
                </Trigger> 
                <Trigger Property="y:ValueConstraint.Nullable" Value="false"> 
                    <Trigger.Setters> 
                        <Setter Property="Background" Value="red"></Setter> 
                    </Trigger.Setters> 
                </Trigger> 
            </Style.Triggers> 
        </Style> 
    </Window.Resources> 
    <StackPanel> 
        <y:XamTextEditor> 
            <y:XamTextEditor.ValueConstraint> 
                <y:ValueConstraint Nullable="False" ></y:ValueConstraint> 
            </y:XamTextEditor.ValueConstraint> 
        </y:XamTextEditor> 
        <y:XamTextEditor></y:XamTextEditor> 
    </StackPanel> 
</Window> 
Parents
  • 905
    posted


    I would like to set mandatory field backgrounds are red and others are green.
    So I try to implement below. But I could not control ValueConstraint Nullable property with trigger.
    Could you help please ?

    <Window x:Class="TriggerGirilmesigerekenalanlar.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:y="http://infragistics.com/Editors"
        Title="Window1" Height="300" Width="300">
        <Window.Resources>
            <Style TargetType="{x:Type y:XamTextEditor}">
                <Style.Triggers>
                    <Trigger Property="ValueConstraint" Value="{x:Null}">
                        <Trigger.Setters>
                            <Setter Property="Background" Value="green"></Setter>
                        </Trigger.Setters>
                    </Trigger>
                    <Trigger Property="y:ValueConstraint.Nullable" Value="false">
                        <Trigger.Setters>
                            <Setter Property="Background" Value="red"></Setter>
                        </Trigger.Setters>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Window.Resources>
        <StackPanel>
            <y:XamTextEditor>
                <y:XamTextEditor.ValueConstraint>
                    <y:ValueConstraint Nullable="False" ></y:ValueConstraint>
                </y:XamTextEditor.ValueConstraint>
            </y:XamTextEditor>
            <y:XamTextEditor></y:XamTextEditor>
        </StackPanel>
    </Window>
     

Reply Children