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
1650
NullText issues and triggers kicking in
posted

Hi there

I have a style that changes the Foreground property of my editor in case a NullText is being displayed:

        <Style.Triggers>
          <!-- change foreground when displaying null texts -->
          <Trigger Property="igEditors:XamTextEditor.Text"
                   Value="">
            <Setter Property="Foreground"
                    Value="#FFABABAB" />
          </Trigger>
        </Style.Triggers>

 

Now strange enough, if the text of the editor is being set programmatically during initialization, the trigger kicks in, and the real text is displayed in grey as well. However, as soon as I select the editor, the Foreground is being adjusted to the correct value and also stays that way if the editor loses focus - looks like a bug to me.

...and as a sidenote: Use NullTexts is somewhat of a pain and pretty inconsistent:

  • Just clearing the text editor sets the underlying property to an empty string, which doesn't cause the NullText to be displayed. Do I really have to write a converter or is there a way to have the NullText displayed for empty strings on an editor?
  • As you can see in the snippet above, I have to trigger the foreground if the Text is an empty string rather then testing for {x:Null} although the bound property is null. Strange as well...

 

Cheers,

Philipp 

  • 138253
    Offline posted

    Hello Philipp,

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

    If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.

  • 5600
    Offline posted in reply to Stefan

    Hello,

    See this forum thread - http://blogs.infragistics.com/forums/p/51262/278354.aspx

    This should be helpful for your scenario.

    Regards,

    Anastas

  • 138253
    Offline posted

    Hello Philipp,

    Thank you for your post. I have been looking through it and I attached a sample project with xamTextEditor using your style. It seems like you do not need to write a converter to cause the NullText to be displayed, since version 10.3. As for the other question, from the UI input there is no difference between null and empty string. You can make that difference in code behind, only.

    If you have any further questions on this matter do not hesitate to ask.

    EditorNullText.zip