Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / How to set selected node highlighted in gray color when the tree loses focus

How to set selected node highlighted in gray color when the tree loses focus

New Discussion
nyinyi
nyinyi asked on Dec 10, 2008 2:34 PM

Hi,

When user selects a node in a tree view , the node is highlighted in Blue color.
I want the selected node highlighted in gray color when the tree view loses focus.
How can i do that?

Thanks

Sign In to post a reply

Replies

  • 0
    Brian Fallon
    Brian Fallon answered on Dec 5, 2008 3:27 PM

    private Infragistics.Win.Appearance focusedAppearance = new Infragistics.Win.Appearance();
    private Infragistics.Win.Appearance notFocusedAppearance = new Infragistics.Win.Appearance();

    this.notFocusedAppearance.BackColor = SystemColors.ControlDark;
    this.focusedAppearance.BackColor = SystemColors.Highlight;

    this.ultraTree1.Override.SelectedNodeAppearance = this.focusedAppearance;
    this.ultraTree1.Enter += new EventHandler(this.ultraTree1_Enter);
    this.ultraTree1.Leave += new EventHandler(this.ultraTree1_Leave);
    this.ultraTree1.HideSelection = false;

    private void ultraTree1_Leave(object sender, EventArgs e)
    {
        UltraTree tree = sender as UltraTree;
        tree.Override.SelectedNodeAppearance = this.notFocusedAppearance;
    }

    private void ultraTree1_Enter(object sender, EventArgs e)
    {
        UltraTree tree = sender as UltraTree;
        tree.Override.SelectedNodeAppearance = this.focusedAppearance;           
    }

    • 0
      Nathan
      Nathan answered on Dec 9, 2008 4:26 PM

       Thanks Brian, that hit the spot.  Is it safe to say there's no appearance property on the control itself for a node when it doesn't have focus?  I liked how the Vista style works on this tree…when a tree loses focus, the previously selected node turns gray.

      • 0
        Brian Fallon
        Brian Fallon answered on Dec 10, 2008 2:34 PM

        [quote user="bedfordn"]Is it safe to say there's no appearance property on the control itself for a node when it doesn't have focus?[/quote]

        No, there is no Appearance designated specifically for when the control does not have focus. If you like you can submit a feature request for such a property.

    • 0
      nyinyi
      nyinyi answered on Dec 10, 2008 8:46 AM

      Dear Brian,

      Thanks much.
      That's exactly what i want.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
nyinyi
Favorites
0
Replies
4
Created On
Dec 10, 2008
Last Post
17 years, 2 months ago

Suggested Discussions

Created by

Created on

Dec 10, 2008 2:34 PM

Last activity on

Feb 24, 2026 2:22 PM