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.
Hi Team,
Please respond.
Eker
Hello Eker,
Thank you for your post. I have been looking into it and I can say that the default Style of the XamTextEditor has changed since version 11.2, so you should update it. The default Templates are located here by default:
C:\Program Files (x86)\Infragistics\2015.1\WPF\DefaultStyles\Editors
In your particular case you should remove the Binding for the Text Property in the EditTemplate. Also the Template now uses SimpleTextBox instead of regular TextBox. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Hi Stefan,
Thanks for the information. That is really helpful. Can I get XamTextEditor default template of v15.2 here ? Because in my machine I don't have Infragistics installed
I have attached a file with the Style.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thanks alot. It really helps. Issue is fixed after updating the EditTemplate & Template of XamTextEditors.