Make RadDocking always dockable

12 posts, 0 answers
  1. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 21 Jul 2014 Link to this post

    Hi,

    i have a scenario where i would like to make the RadDocking always dockable. When you right click and get the options(Dockable, Floating, TabbedDocument, Auto Hide, Hide and so on) i would like to hide the Dockable item from the ContextMenu so you can't turn Dockable off.

    Thanks.
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 23 Jul 2014 Link to this post

    Hi Jesper,

    You can easily remove the Dockabe option from the ContextMenu by modifying the default ContextMenuTemplate of RadPane. What you need to do would be set the following Style in App.xaml:

    <telerik:InvertedBooleanConverter x:Key="InvertedBooleanConverter"/>
     
    <Style TargetType="telerik:RadPane">
        <Setter Property="ContextMenuTemplate">
            <Setter.Value>
                <DataTemplate>
                    <telerik:RadContextMenu InheritDataContext="False">
                        <telerik:RadMenuItem
                        IsChecked="{Binding IsFloatingOnly}"
                        Command="telerik:RadDockingCommands.Floating"
                        CommandParameter="{Binding}"
                        CommandTarget="{Binding}"
                        Header="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>
                        <!--<telerik:RadMenuItem
                        IsChecked="{Binding IsDockableOptionChecked}"
                        Command="telerik:RadDockingCommands.Dockable"
                        CommandParameter="{Binding}"
                        CommandTarget="{Binding}"
                        Header="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>-->
                        <telerik:RadMenuItem
                        IsChecked="{Binding IsInDocumentHost}"
                        Command="telerik:RadDockingCommands.TabbedDocument"
                        CommandParameter="{Binding}"
                        CommandTarget="{Binding}"
                        Header="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>
                        <telerik:RadMenuItem
                        IsChecked="{Binding IsPinned, Converter={StaticResource InvertedBooleanConverter}}"
                        Command="telerik:RadDockingCommands.Pin"
                        CommandParameter="{Binding}"
                        CommandTarget="{Binding}"
                        Header="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>
                        <telerik:RadMenuItem
                        IsChecked="{Binding IsHidden}"
                        Command="telerik:RadDockingCommands.Close"
                        CommandParameter="{Binding}"
                        CommandTarget="{Binding}"
                        Header="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>
                    </telerik:RadContextMenu>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    And the Dockable options should be no more present in the ContextMenu of the Pane.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 23 Jul 2014 in reply to Kalin Link to this post

    Thanks, i already tried your suggestion, but then i can't add the Auto hide to the ContextMenu as there seems to be no command called that.
  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 24 Jul 2014 Link to this post

    Hello Jesper,

    I'm not sure if I correctly understand the exact requirement here. Could you please share some more details on what exactly you need to achieve, so we can provide you with the best possible solution? What is the exact scenario in which you want to add Auto hide to the ContextMenu?

    I'm looking forward to hearing from you.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 24 Jul 2014 in reply to Kalin Link to this post

    Hello Kalin,

    it is because i want to hide the "Dockable" text from the ContextMenu so it is not possible to deselect it, as it should always be dockable. But using the code you posted i want to add Auto Hide to the ContextMenu too, but there doesn't seems to be any AutoHide command in telerik:RadDockingCommands?. So to sum up: i want to remove the "Dockable"  item,  but to remove it, i have to make a custom ContextMenu as the code you posted. But making the custom ContextMenu, i can't add the AutoHide to the ContextMenu, as there doesn't seems to be a command called that. I hope this explains my problem better.

    Thanks.
  7. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 28 Jul 2014 Link to this post

    Hello,

    Actually the Pane in the AutoHide area is pinned, so the command you need to use is telerik:RadDockingCommands.Pin. However there is such a MenuItem in the ContextMenu I suggested you in my initial post. Could please test it and let me know why this doesn't work for you? Note that the Pane should be docked in order to be able to Pin it. So if you want to Pin floating Pane - you would need to implement a custom Command which will dock the Pane and pin it afterwards.

    Hope this will help you to achieve the required.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  8. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 30 Jul 2014 Link to this post

    Hey,

    when using your code above, the dockable option is not visible in the ContextMenu when it is docked, but when it is floating the dockable option appears again in the ContextMenu which it should not. Also when using the code you posted, the Auto hide option is never clickable in the ContextMenu. Can you maybe make a sample project which shows how to accomplish this?.

    Thanks.
  9. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 30 Jul 2014 in reply to Jesper Link to this post

    Also how do i make it so, if you right click and select the Floating option in the ContextMenu when it is docked, then when it is floating and you right click on the window again, the Floating option should be hidden. But when you dock the window again and right click it should show the Floating option in the ContextMenu again?.

    Example:
    Window is docked = Show Floating option in ContextMenu
    Window is floating = Hide Floating option in ContextMenu.

    Thanks, and again i hope you can make a sample project of how to fix these issues.
  10. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 30 Jul 2014 Link to this post

    Hi Jesper,

    You can achieve the desired by using an IValueConverter. You can use our InvertedBooleanToVisibilityConverter to toggle the Visibility of the Floating item. For your convenience I have prepared a sample project which demonstrates the exact approach.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  11. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 31 Jul 2014 in reply to Kalin Link to this post

    Thanks Kalin.

    I have another question. When using the custom Pin command, there is no animation when it is pinned and auto hiding and you hover the mouse over like there is standard. Instead it just show instantly. How would i achieve this?

    Thanks.
  12. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 31 Jul 2014 in reply to Jesper Link to this post

    Using the sample you provided it does not work with IsFloatingOnly, but it works fine with IsFloating. 

    Thanks for the help.
  13. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 04 Aug 2014 Link to this post

    Hi Jesper,

    I'm glad it helped. If you have any other questions let us know.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready