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

RadHtmllPlaceholder in a RadDocumentPane

7 Answers 64 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 24 Sep 2009, 04:10 PM

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?

7 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 25 Sep 2009, 02:43 PM
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.
0
Dave
Top achievements
Rank 1
answered on 29 Sep 2009, 03:30 PM
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
0
Miroslav Nedyalkov
Telerik team
answered on 30 Sep 2009, 01:41 PM
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.
0
Dave
Top achievements
Rank 1
answered on 30 Sep 2009, 02:23 PM

DELETED....Fix my error

0
Dave
Top achievements
Rank 1
answered on 30 Sep 2009, 03:03 PM

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.
0
Miroslav Nedyalkov
Telerik team
answered on 01 Oct 2009, 07:59 AM
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.
0
Dave
Top achievements
Rank 1
answered on 01 Oct 2009, 03:42 PM
This worked great.  Thanks.
Tags
Docking
Asked by
Dave
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Dave
Top achievements
Rank 1
Share this question
or