Disallow Select but stay enabled

3 posts, 0 answers
  1. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Jun 2009 Link to this post

    Hello,

    I'm using a tree view for a wizard, to show the users what step they are on. It seems perfect for it as I can use different images for each step.

    However, I'd like to be able to keep the control enabled (so that the images and the selected node show in colour), but also disallow the user from selecting a different node. Can you tell me if this is possible, or perhaps some workaround that may do the same thing please?

    Thanks
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Jun 2009 Link to this post

    Hello,

    I've figured out an easy way to do this now, so no need for a reply.
    Thanks.

    For reference, I have done the following:

     

    ''' <summary>Used to allow the class to internally select an item. Not for user use</summary>

     

     

    Private m_AllowSelect As Boolean

     


     

    ''' <summary>Cancel the selection if a user tries to select another node in the tree</summary>

     

     

    Private Sub RadTreeView_Selecting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.RadTreeViewCancelEventArgs) Handles RadTreeView.Selecting

     

    e.Cancel =

    Not m_AllowSelect

     

     

    End Sub

     


    and where I need to set the selected item internally....

    m_AllowSelect =

    True 'temp allow select

     

    node.Selected =

    True

     

    m_AllowSelect =

    False 'disallow select

     


    This means I can set it programatically from the class, but the users cannot.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 22 Jun 2009 Link to this post

    Hello Richard Slade,

    You can achieve the desired behavior in two ways.

    You can either subscribe to RadTreeView Selected event and do this:

    void radTreeView1_Selected(object sender, EventArgs e)  
    {  
        this.radTreeView1.SelectedNode = null;  

    Or you can subscribe to the Selecting event and do this:

    void radTreeView1_Selecting(object sender, RadTreeViewCancelEventArgs e)  
    {  
        e.Cancel = true;  

    I hope that helps. Do not hesitate to write me back if you have further questions.

    Best wishes,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top