RadHtmllPlaceholder in a RadDocumentPane

8 posts, 0 answers
  1. Dave
    Dave avatar
    26 posts
    Member since:
    Jun 2009

    Posted 24 Sep 2009 Link to this post

    I am currently using a RadHtmllPlaceholder in the document pane.  When the user unpins one of my RadPanes it collapses.  When the user does a mouse over of the tab it appears behind the RadHtmlPlaceholder.  I understand that the RadHtmlPlaceholder is ‘floating’ above my Silverlight and that there is not a z-Index workaround.  What I am wondering is there an event that gets fired when the user mouse over the tab that will allow me to catch the event and resize the document pane?

  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 Sep 2009 Link to this post

    Hello Dave,

    The event that is fired is the SelectionChangedEvent routed event of the RadTabControl class. This event is fired from the AutoHideArea control. As it is routed event, you could listen the Docking control for it and hide/show the HTMLPlaceHolder.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Dave
    Dave avatar
    26 posts
    Member since:
    Jun 2009

    Posted 29 Sep 2009 Link to this post

    Do you have a code sample for this?  I am confused as to where I am subscribing to SelectionChangedEvent.  I can see a Selection Change evnet fire when I unpin but not when I mouse over the tab in the auto hide area. 

    thanks
  4. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 30 Sep 2009 Link to this post

    Hi Dave,

    Here is an example that demonstrates the idea:
    public MainPage() 
        InitializeComponent(); 
        this.dock.AddHandler(RadTabControl.SelectionChangedEvent, new RoutedEventHandler(this.OnSelectionChanged), true); 
     
    private void OnSelectionChanged(object sender, RoutedEventArgs args) 
        var a = args as RadRoutedEventArgs; 
        if (a != null
        { 
            var autoHide = a.OriginalSource as AutoHideArea; 
            if (autoHide != null
            { 
                // Write your code here ... 
                Debug.WriteLine("Coool!"); 
            } 
        } 

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Dave
    Dave avatar
    26 posts
    Member since:
    Jun 2009

    Posted 30 Sep 2009 Link to this post

    DELETED....Fix my error

  6. Dave
    Dave avatar
    26 posts
    Member since:
    Jun 2009

    Posted 30 Sep 2009 Link to this post

    Do you see any error in the following code?

    private void OnSelectionChanged(object sender, RoutedEventArgs args)  
            {  
                var a = args as RadRoutedEventArgs;  
     
                var autoHide = a.OriginalSource as AutoHideArea;  
                if (autoHide != null)  
                {  
                    if(autoHide.SelectedPane != null)  
                        autoHide.SelectedPane.IsPinned = true;  
                }  
     
            }  
     


    It does not work.  I can hit all the lines of code in the debuger.
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 01 Oct 2009 Link to this post

    Hi Dave,

    This won't work, because you cannot change the items of a RadTabControl during SelectionChanged event and what you do when you set the IsPinned property of the RadPane control to false is to move it back to its group. What you could do to work-around this problem is to change the IsPinned property asynchronously (with Dispatcher), but I don't recommend this. The other problem in this scenario is that the RadTabControl selects its first element if it doesn't have any selected elements and this causes SelectionChanged event to be fired when you unpin panes.

    What I would recommend you is to hook up to the MouseOver event of each pane and to when this event is fired you could pin it back. Here is an example:
    void OnPaneMouseOver(object sender, MouseEventArgs e) 
        var pane = sender as RadPane; 
        if (pane != null && pane.Parent is AutoHideArea) 
        { 
            pane.IsPinned = true
        } 
     
    I have two suggestions about how to hook up to this event (you could prefer some other way - this are just suggestions):
    1. You could go through all the panes and hook up to the event once the Docking control is initialized:
    public MainPage() 
        InitializeComponent(); 
        foreach (var p in this.dock.Panes) 
        { 
            p.MouseEnter += new MouseEventHandler(OnPaneMouseOver); 
        } 
    2. You could hook up to the Pin and Unpin events of the Docking control to hook up only to the MouseEnter event of the unpinned panes:
    private void dock_Pin(object sender, StateChangeEventArgs e) 
        foreach (var p in e.Panes) 
        { 
            p.MouseEnter -= OnPaneMouseOver; 
        } 
     
    private void dock_Unpin(object sender, StateChangeEventArgs e) 
        foreach (var p in e.Panes) 
        { 
            p.MouseEnter += OnPaneMouseOver; 
        } 

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Dave
    Dave avatar
    26 posts
    Member since:
    Jun 2009

    Posted 01 Oct 2009 Link to this post

    This worked great.  Thanks.
Back to Top