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
335
XamTextEditor loses value in upgrade from 11.2 to 15.1
posted

Hello Team,

We are in need of fix for below issue relatively faster. When we enter values in XamTextEditor and leave out from that field, whatever been entered is getting cleared. This behavior happens after WPF Infragistics upgrade from 11.2 to 15.1

Below is one such control and the style that we defined.

Control

<igEditors:XamTextEditor Grid.Row="0" Grid.Column="6" Text="{ Binding DummyEmployeeID, FallbackValue={x:Null}, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True,NotifyOnValidationError=True  }"
                    Grid.ColumnSpan="5" behaviours:TextBoxBehaviours.EnterKeyCommand="{Binding SearchCommand}"
                    Style="{DynamicResource UpperCaseTextEditor}">
                    <igEditors:XamTextEditor.ValueConstraint>
                        <igEditors:ValueConstraint MaxLength="15"/>
                    </igEditors:XamTextEditor.ValueConstraint>
                </igEditors:XamTextEditor>

Style

<Style x:Key="UpperCaseTextEditor" TargetType="{x:Type igEditors:XamTextEditor}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource EditorsBrushKeys.EditorsNormalBorderFillKey}"/>
        <Setter Property="FontFamily" Value="{DynamicResource My_Text}" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="Margin" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                    <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <!--<igWindows:SimpleTextBlock  x:Name="TextBlock" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" TextAlignment="{TemplateBinding TextAlignmentResolved}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding DisplayText}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>-->
                        <TextBlock  x:Name="TextBlock" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" TextAlignment="{TemplateBinding TextAlignmentResolved}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding DisplayText}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEmbedded" Value="False">
                            <Setter Property="CornerRadius" TargetName="MainBorder" Value="1"/>
                            <!--<Setter Property="igWindows:SimpleTextBlock.OptimizeWidthMeasurement" Value="False"/>-->
                            <!--<Setter Property="TextBlock.OptimizeWidthMeasurement" Value="False"/>-->
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="EditTemplate">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                    <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                        <TextBox x:Name="PART_FocusSite" CharacterCasing="Upper" AcceptsTab="{TemplateBinding AcceptsTab}"
                                 AcceptsReturn="{TemplateBinding AcceptsReturn}" BorderBrush="Transparent" BorderThickness="0"
                                 Background="Transparent" ContextMenu="{TemplateBinding ContextMenu}" Foreground="{TemplateBinding Foreground}"
                                 HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                 HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
                                 InputMethod.IsInputMethodEnabled="{TemplateBinding InputMethod.IsInputMethodEnabled}"
                                 IsReadOnly="{TemplateBinding ReadOnly}" SpellCheck.IsEnabled="{TemplateBinding SpellCheck.IsEnabled}"
                                 MaxLength="{Binding ValueConstraint.MaxLength, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                 InputMethod.PreferredImeState="{TemplateBinding InputMethod.PreferredImeState}"
                                 Padding="{TemplateBinding Padding}" SpellCheck.SpellingReform="{TemplateBinding SpellCheck.SpellingReform}"
                                 TextAlignment="{TemplateBinding TextAlignmentResolved}" TextWrapping="{TemplateBinding TextWrapping}"
                                 Text="{Binding Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
                                 VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
                                 VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsInEditMode" Value="True">
                            <Setter Property="IsTabStop" Value="False"/>
                            <Setter Property="Padding" Value="0,2,2,2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEmbedded" Value="True">
                <Setter Property="BorderThickness" Value="0"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEmbedded" Value="True"/>
                    <Condition Property="IsInEditMode" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="BorderThickness" Value="0"/>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEmbedded" Value="True"/>
                    <Condition Property="IsInEditMode" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{x:Null}"/>
                <Setter Property="BorderBrush" Value="{x:Null}"/>
                <Setter Property="Padding" Value="2"/>
            </MultiTrigger>
            <Trigger Property="IsEmbedded" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}"/>
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

 

Thanks,

Eker.

Parents Reply Children