how to wrap treeview control events

6 posts, 0 answers
  1. manjerekar
    manjerekar avatar
    10 posts
    Member since:
    Jul 2010

    Posted 05 Aug 2010 Link to this post

    Hi Team,

    I'm writing a wrapper class basically to enable only few of the properties and events from the RadTreeView control.

    i want to enable the events

    Selected

     

     

    ="radTreeView1_Selected" Expanded="radTreeView1_Expanded" Collapsed="radTreeView1_Collapsed"

     

    of the RadTreeView control in my wrapper class. 

    here is my wrapper class.

    public

     

     

    class TngTreeView : TngBaseControl

     

    {

    #region

     

     

    Constructors

     

     

     

    static TngTreeView()

     

    {

    DefaultStyleKeyProperty.OverrideMetadata(

     

    typeof(TngTreeView), new FrameworkPropertyMetadata(typeof(TngTreeView)));

     

    RegisterDependencyProperties(

     

    typeof(TngTreeView), typeof(RadTreeView));

     

    }

     

     

    public TngTreeView()

     

    {

    InternalFrameworkElement =

     

    new RadTreeView();

     

     

     

    this.AddVisualChild(InternalFrameworkElement);

     

    }

    #endregion

    #region

     

     

    Internal Control

     

     

     

    private RadTreeView TreeView

     

    {

     

     

    get

     

    {

     

     

    return InternalFrameworkElement as RadTreeView;

     

    }

    }

     

     

    public RadTreeView InternalControl

     

    {

     

     

    get

     

    {

     

     

    return TreeView;

     

    }

     

     

    set

     

    {

    InternalControlSetter(TreeView,

     

    value);

     

    }

    }

    #endregion

     

     

     

    #region

     

     

    Property: ToolTip

     

     

     

    public string ToolTip

     

    {

     

     

    get { return (string)TreeView.GetValue(RadTreeView.ToolTipProperty); }

     

     

     

    set { TreeView.SetValue(RadTreeView.ToolTipProperty, value); }

     

    }

    #endregion


    }

    appreciate your help

    Manjerekar Rao
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 05 Aug 2010 Link to this post

    Hello manjerekar,

    Could you elaborate a little on the problems you are encountering? Does registering for the TreeView events and re-raising them as custom events work in your case?

    Regards,
    Miroslav
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. manjerekar
    manjerekar avatar
    10 posts
    Member since:
    Jul 2010

    Posted 05 Aug 2010 Link to this post

    I haven't registered yet.
    i want to register the TreeView events and re-raise them as custom events. how to do this?

    do u have any contact no. to call you and do you provide instant chat facility.


    help much appreciated
    Manjerekar Rao
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 10 Aug 2010 Link to this post

    Hi manjerekar,

    If you want to expose simple CLR events this may happen like so:

    public class TngTreeView
    {
        RadTreeView treeView;
      
        public TngTreeView()
        {
            treeView.Expanded += new 
                EventHandler<RadRoutedEventArgs>(treeView_Expanded);
        }
      
        void treeView_Expanded(object sender, RadRoutedEventArgs e)
        {
            if (this.Expanded != null)
            {
                this.Expanded(this, e);
            }
        }
      
        public event EventHandler<RadRoutedEventArgs> Expanded;
    }

    We do not normally offer phone support - we will be happy to anwer your question here.

    All the best,
    Miroslav
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Srinivas
    Srinivas avatar
    32 posts
    Member since:
    Aug 2010

    Posted 12 Aug 2010 Link to this post

    Hi Miroslav,

    These is with reference to your's and Manjurekar's post.

    The answer that you repiled in code says that , the end user should use Telerik DLL to use those wraped events. which that we (manjurekar and me) not required . End user should use the DLL what we provided from the framework we are developing and able to use the events.


    Thanks ,
    Srinivas

  7. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 17 Aug 2010 Link to this post

    Hi Srinivas,

    Yes, the Telerik dlls will be needed since the wrapper dlls will be referencing them. It will not be possible to wrap the Telerik controls without eventually using the dlls.

    If you want to have a different public API, you can just expose an event with custom event args, say

    public event EventHandler<MyEventArgs> Expanded;

    All the best,
    Miroslav
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready