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

Support for SelectedItemRemoveBehaviour

4 Answers 112 Views
Docking
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marc
Top achievements
Rank 1
Marc asked on 02 Sep 2011, 10:29 AM
Hi,

the SelectedItemRemoveBehaviour in RadDocking/RadPaneGroup doesn't work, right? Or am I doing something wrong?

Regards,
Stephan

4 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 02 Sep 2011, 04:31 PM
Hello Stephan,

 Yes, this property is not supported in the Docking control as it manipulates the selection itself and overrides its effect.

Best wishes,
Miroslav Nedyalkov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Marc
Top achievements
Rank 1
answered on 02 Sep 2011, 04:36 PM
Thank you for your answer.

Is there at least an option to disable the automatic selection of the first pane in the document are when closing a pane, so that i can implement the "activate previous active tab on close" behaviour without jumping through two tabs?


Nice weekend,
Stephan
0
Miroslav Nedyalkov
Telerik team
answered on 07 Sep 2011, 10:30 AM
Hi Stephan,

 As this is not a supported feature of the RadDocking control there is not an easy way to do this. What I might suggest you is to inherit from the RadPaneGroup and override the OnItemsChanged method and change the selection just before calling the base method. To do this you need to also implement a GeneratedItemsFactoy and set it to the Docking control. This way the Docking control will know that you are using a custom pane groups.
Here is the code that demonstrates what I suggest:

<telerik:RadDocking x:Name="dock" Grid.Row="1" PaneStateChange="dock_PaneStateChange">
    <telerik:RadDocking.GeneratedItemsFactory>
        <local:GeneratedItemsFactory />
    </telerik:RadDocking.GeneratedItemsFactory>
    <telerik:RadDocking.VisualCueStyle>
        <Style TargetType="telerik:VisualCue">
            <Setter Property="Background" Value="Red" />
        </Style>
                 
    </telerik:RadDocking.VisualCueStyle>
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer>
            <local:CustomPaneGroup>
                <telerik:RadPane Header="Document pane" />
            </local:CustomPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
    <telerik:RadSplitContainer>
        <local:CustomPaneGroup>
            <telerik:RadPane Header="Some header 1" />
            <telerik:RadPane Header="A" />
            <telerik:RadPane Header="B" />
        </local:CustomPaneGroup>
 
        <local:CustomPaneGroup>
            <telerik:RadPane Header="Some header 2">
                <Button Content="Some content" Click="OnTestClicked" LostMouseCapture="OnTestLostMouseCaputre" />
            </telerik:RadPane>
            <telerik:RadPane x:Name="treeView" Header="TreeView">
                <telerik:RadTreeView>
                    <telerik:RadContextMenu.ContextMenu>
                        <telerik:RadContextMenu Opened="RadContextMenu_Opened">
                        </telerik:RadContextMenu>
                    </telerik:RadContextMenu.ContextMenu>
                    <telerik:RadTreeViewItem Header="Item #1">
                        <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                        <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                        <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                    </telerik:RadTreeViewItem>
                    <telerik:RadTreeViewItem Header="Item #2" />
                    <telerik:RadTreeViewItem Header="Item #3" />
                </telerik:RadTreeView>
            </telerik:RadPane>
 
            <telerik:RadPane Header="TreeView 1">
                <telerik:RadTreeView>
                    <telerik:RadContextMenu.ContextMenu>
                        <telerik:RadContextMenu>
                        </telerik:RadContextMenu>
                    </telerik:RadContextMenu.ContextMenu>
                    <telerik:RadTreeViewItem Header="Item #1">
                        <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                        <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                        <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                    </telerik:RadTreeViewItem>
                    <telerik:RadTreeViewItem Header="Item #2" />
                    <telerik:RadTreeViewItem Header="Item #3" />
                </telerik:RadTreeView>
            </telerik:RadPane>
        </local:CustomPaneGroup>
        <local:CustomPaneGroup>
            <telerik:RadPane x:Name="Pane1" Header="Pane1">
                <Button Content="Pane1" Click="OnTestClicked" LostMouseCapture="OnTestLostMouseCaputre" />
            </telerik:RadPane>
        </local:CustomPaneGroup>
    </telerik:RadSplitContainer>
</telerik:RadDocking>
Where CustomPaneGroup class is:
public class CustomPaneGroup : RadPaneGroup
{
    protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
    {
        bool isRemovingSelected = e.OldItems != null && e.OldItems.Contains(this.SelectedItem);
        if (isRemovingSelected)
        {
            this.SelectedItem = this.Items.OfType<RadPane>().LastOrDefault();
        }
        base.OnItemsChanged(e);
    }
}

And the GeneratedItemsFactory class is:
public class GeneratedItemsFactory : DefaultGeneratedItemsFactory
{
    public override Telerik.Windows.Controls.RadPaneGroup CreatePaneGroup()
    {
        return new CustomPaneGroup();
    }
}

Hope this helps.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Marc
Top achievements
Rank 1
answered on 07 Sep 2011, 10:32 AM
Wow, great support. Thank you. I'll investigate that further...
Tags
Docking
Asked by
Marc
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Marc
Top achievements
Rank 1
Share this question
or