Hi
I am using MS Expression Blend (v4) to template and style my controls (for a new application)
On the XamTextEditor you can define the null text and following creating it into a template you can change various attributes.
For example, I have set a storyboard for got focus and lost focus (on the current and the edit controls) to ensure that when the user moves over or into the editbox the background colour changes.
This was achieved using storyboards and event triggers (on the mouseEnter/Leave for the textblock and the IsFocused attribute of the PART_FocusSite)
I have additionally modified the <igWindows:SimpleTextBlock ..> control in the current template to make the NULL text appear as Italics.
Howerver, following user data input and when they move out of that control, the standard input text reverts to italics (as opposed to Normal) . I think I understand that this may be due to the displaytext being reset to that input by the user (thus overwriting the null text value)
In this case (where the NULL text is NOT going to be used) I need to ensure that the FontStyle is reverted to Normal
I cannot see a trigger or event which I can trap in the resources to handle this.
Is there a way to achive this, i.e. NULL text to appear in Italics and when control has value and user text is entered this to appear as Normal?
It would be great if all this could be achieved in the resource file as I can then ship this (complete with outer changes) to be used on other projects and by other developers in the company.
Thanks
Urfan
Hello,
Look at the attached sample.
I just add defaultStyle for XamTextEditor in my project(which is in the defaultStyle folder in installed location: C:\ProgramFiles\Infragistics...). And add one trigger in this defaultStyle file(named EditorsGeneric_Express.xaml).
When nullText is visible in the xamTextEditor the value property is 'null'.
So this trigger checks if Value={x:Null} and set the FontStyle property to Italic.
Hope this helps.
Best regards,
Anastas
Thanks Anastas
I didnt see this reply until today, not sure I was sent email to notify me
I will download this now and have a play
thanks
Well this is very very good and it ALMOST works!
Initial null text is correctly italics, then you enter some info and its then normal.
Fab!
BUT, if you then blank out your text from the textbox then tab out, the null text re-appears but is NOT italics
I think the trigger evaluation on the Value property must NOT be returning NULL when you clear and exit the control.
I've tried checking for value="" but that does not work either
Are you using the xamTextEditor as a stand alone control in your application, or at the xamDataGrid(the default editor for text fields)?
The 12.2.1000 version seems to work fine when using the xamTextEditor as a stand alone control.
Looking forward for your reply.
Regards,
Its 12.2.1000
Attached is the complete theme file we are using, to apply theme.
Which version of our product you are using(it looks like 13.1.1000)?
I test this and it seems to work fine on my machine.
Hi Anastas,
The above example wroked for me as well. But I have additinal requirement of changing font color as well.
We have applied below theme on text editors. Italics works fine but color is not getting changed. Can you please suggest
<Style TargetType="editors:XamTextEditor"> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="FontFamily" Value="{StaticResource SystemFontFamily}"/> <Setter Property="BorderBrush" Value="{StaticResource FieldBorderBrushEDITMODE}"/> <Setter Property="FontSize" Value="{StaticResource SystemFontSize}"/> <Style.Triggers> <Trigger Property="IsReadOnly" Value="True"> <Setter Property="BorderBrush" Value="{StaticResource FieldBorderBrushREADONLY}"/> <Setter Property="Background" Value="{StaticResource FieldBackgroundREADONLY}"/> </Trigger> <Trigger Property="AcceptsReturn" Value="true"> <Setter Property="VerticalScrollBarVisibility" Value="Visible"/> <Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="VerticalAlignment" Value="Top"/> </Trigger> <Trigger Property="Text" Value="{x:Static sys:String.Empty}" > <Setter Property="FontStyle" Value="Italic" /> <Setter Property="Foreground" Value="Red"/> </Trigger> <Trigger Property="Value" Value="{x:Null}" > <Setter Property="FontStyle" Value="Italic" /> <Setter Property="Foreground" Value="Red"/> </Trigger> </Style.Triggers> </Style>
Hi Anastas
I just tried that and it WORKS!
Great work. Many thanks for your contribution.