Tree View Events are not firing.

5 posts, 0 answers
  1. Stephen Holder
    Stephen Holder avatar
    3 posts
    Member since:
    Jun 2012

    Posted 25 May 2010 Link to this post

    SilverLight version 4
    Internet Explorer version 8
    Windows Server 2008

    I had regular SilverLight TreeView controls.  I replace one of them with the Telerik TreeView control.  This one in particular had no event hook-ups.  I wanted to disable the expanding and collapsing of nodes so that the control will always stay expanded.  I hooked into two events as the coded example:

    <telerik:RadTreeView x:Name="tvMDocs" PreviewExpanded="tvMDocs_PreviewExpanded" PreviewCollapsed="tvMDocs_PreviewCollapsed" /> 


    The code behind is as the following:

     
            private void tvMDocs_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e)  
            {  
                e.Handled = true;  
            }  
     
            private void tvMDocs_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e)  
            {  
                e.Handled = true;  
            }  
     

    I have the break points set to stop at the "e.Handled = true".  I am assuming that the events are not firing because it does not stop at these points. Any suggestions to why this isn't working would be greatly appreciated.

    Steve

  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 26 May 2010 Link to this post

    Hi Stephen Holder,

    This is indeed unexpected. Do you mean that the user can still collapse an item?

    Is it possible that handling the PreviewExpanded event cancels out a possible ExpandAll() call?

    You can have a look at the attached project where this seems to work. Am I missing something?

    Kind 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. Stephen Holder
    Stephen Holder avatar
    3 posts
    Member since:
    Jun 2012

    Posted 26 May 2010 Link to this post

    Miroslav,

     


        Yes, your little project works fine.  I can set a break point at the "e.Handled = true;" and the debugger does stop at the break point.
    This is very straight forward code and almost identical to my code except that I do not have the TreeViewItems hard coded in the xaml.  The treeview items are built in code behind using the directory structure and files from SharePoint sites.  I set each item's "IsExpanded" as they are added to the tree.  The other difference is that the treeviews are in two seperate RadTiles which shouldn't make a difference on the firing of the events.  As I said in my original question, I am fairly sure that the PreviewCollasped and PreviewExpanded are not fiiring back to my code behind because they don't stop at the breakpoints in my code.
        I am going to try an experiment by making a small hard coded Treeview as per your sample code, within my page and see if that works. My concern is that perhaps the code I am using to load my Treeview is not loading it correctly even though it displays correctly and thus the events don't fire.  I will let you know how this goes.

    Steve

     

  4. Stephen Holder
    Stephen Holder avatar
    3 posts
    Member since:
    Jun 2012

    Posted 26 May 2010 Link to this post

    Miroslav,

        I guess I am at square one.  I can make a new tile and cut and paste your sample xaml with an event code-behind function and
    it works.  I think I am probably going to have to recode the recursive logic that I was using to fill the SilverLight 4 Treeview Control
    because there must be some difference in how I should be filling it.  I will look on your site at sample code and try to rework this.
    I will let you know how I solve it but it may take me a while.

    Steve
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 27 May 2010 Link to this post

    Hello Stephen Holder,

    This is indeed strange. Can you send us a sample project where the events are not fired?

    If you will be displaying a file-folder system, it may be best to databind the TreeView and use virtualization since it will scale much better. I tried the always-expand in this scenario as well, you can check out the attached project.

    Which version of the controls are you using?

    Greetings,
    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