This is a migrated thread and some comments may be shown as answers.

AfterLabelEdit and EndEdit

1 Answer 130 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Marek
Top achievements
Rank 1
Marek asked on 04 Sep 2007, 03:13 PM

We want to extend the functionality of RadTreeView and have therefore done something like this: 

public class DerivedTree : RadTreeView
{
  public DerivedTree()
  {
    this.AllowEdit = true;
    this.AfterLabelEdit += new AfterLabelEditHandler  (DerivedTree_AfterLabelEdit);
  }
}

We then have two problems.  The first is that we get an obsolete warning about using AfterLabelEdit and using EndEdit instead.

The problem is that EndEdit is just a method and not virtual and as far as I could see and there is no equivalent OnEndEdit event.  How should we use this functionality correctly?

The second problem is that when we use this control all the [hot] feedback and node selection indication does not appear any more.  What is the problem and how can we correct it.

Best regards

Marek

1 Answer, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 05 Sep 2007, 10:43 AM
Hi Marek,

We are sorry that the obsolete events cause such confusion. However we believe this is for good as we are
implementing a framework for editor support in RadTreeView. We will be happy if you work with us towards a stable and extensible RadTreeView.

Regarding your issues with deriving form RadTreeView - they all have an easy solution as demonstrated below:

public class DerivedTreeView : RadTreeView 
    { 
        public DerivedTreeView() : base() 
        { 
            this.AllowEdit = true
            this.Edited += new EventHandler(DerivedTreeView_Edited); 
            this.ValueValidating += new CancelEventHandler(DerivedTreeView_ValueValidating); 
        } 
 
        protected override void CreateChildItems(Telerik.WinControls.RadElement parent) 
        { 
            base.CreateChildItems(parent); 
             
            //set the theme to use 
            this.ThemeName = "ControlDefault"
        } 
 
        //return the RadTreeView type name to enable original themes 
        public override string ThemeClassName 
        { 
            get 
            { 
                return typeof(RadTreeView).FullName; 
            } 
        } 
 
        void DerivedTreeView_ValueValidating(object sender, CancelEventArgs e) 
        { 
            System.Diagnostics.Debug.WriteLine("DerivedTreeView_ValueValidating"); 
            if ((this.ActiveEditor.Value as string).Length > 7) 
            { 
                e.Cancel = true
            } 
        } 
 
        void DerivedTreeView_Edited(object sender, EventArgs e) 
        { 
            System.Diagnostics.Debug.WriteLine("DerivedTreeView_Edited"); 
            System.Diagnostics.Debug.WriteLine("New value: " + this.SelectedNode.Text); 
        } 
    } 

Thank you for your cooperation.

 
All the best,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Treeview
Asked by
Marek
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Share this question
or