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

Make RadDocking always dockable

11 Answers 186 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Jesper
Top achievements
Rank 2
Jesper asked on 21 Jul 2014, 04:28 PM
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.

11 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 23 Jul 2014, 12:28 PM
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.
 
0
Jesper
Top achievements
Rank 2
answered on 23 Jul 2014, 12:44 PM
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.
0
Kalin
Telerik team
answered on 24 Jul 2014, 08:45 AM
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.
 
0
Jesper
Top achievements
Rank 2
answered on 24 Jul 2014, 11:38 AM
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.
0
Kalin
Telerik team
answered on 28 Jul 2014, 08:39 AM
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.
 
0
Jesper
Top achievements
Rank 2
answered on 30 Jul 2014, 07:09 AM
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.
0
Jesper
Top achievements
Rank 2
answered on 30 Jul 2014, 11:00 AM
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.
0
Kalin
Telerik team
answered on 30 Jul 2014, 01:03 PM
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.
 
0
Jesper
Top achievements
Rank 2
answered on 31 Jul 2014, 06:12 AM
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.
0
Jesper
Top achievements
Rank 2
answered on 31 Jul 2014, 06:28 AM
Using the sample you provided it does not work with IsFloatingOnly, but it works fine with IsFloating. 

Thanks for the help.
0
Kalin
Telerik team
answered on 04 Aug 2014, 11:08 AM
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.
 
Tags
Docking
Asked by
Jesper
Top achievements
Rank 2
Answers by
Kalin
Telerik team
Jesper
Top achievements
Rank 2
Share this question
or