Support for SelectedItemRemoveBehaviour

5 posts, 0 answers
  1. Marc
    Marc avatar
    88 posts
    Member since:
    Jul 2011

    Posted 02 Sep 2011 Link to this post

    Hi,

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

    Regards,
    Stephan
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 02 Sep 2011 Link to this post

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

  3. DevCraft banner
  4. Marc
    Marc avatar
    88 posts
    Member since:
    Jul 2011

    Posted 02 Sep 2011 Link to this post

    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
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Sep 2011 Link to this post

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

  6. Marc
    Marc avatar
    88 posts
    Member since:
    Jul 2011

    Posted 07 Sep 2011 Link to this post

    Wow, great support. Thank you. I'll investigate that further...
Back to Top
DevCraft banner