View:
<syncfusion:DockingManager x:Name="SyncDockingManager" Grid.Row="1" >
<interaction:Interaction.Behaviors>
<local:ViewModel/>
</interaction:Interaction.Behaviors>
<ContentControl x:Name="SolutionExplorer" syncfusion:DockingManager.Header="Solution Explorer" />
<ContentControl x:Name="ToolBox" syncfusion:DockingManager.Header="Toolbox" />
<ContentControl x:Name="Properties" syncfusion:DockingManager.Header="Properties" />
<ContentControl x:Name="Output" syncfusion:DockingManager.Header="Output"/>
<ContentControl x:Name="StartPage" syncfusion:DockingManager.Header="Start Page" />
</syncfusion:DockingManager>
ViewModel:
public class ViewModel : Behavior<UIElement>
{
protected override void OnAttached()
{
Window parent = Application.Current.MainWindow;
AssociatedObject.PreviewKeyDown += (sender, e) =>
{
if (e.Key == Key.S && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
{
(AssociatedObject as DockingManager).SaveDockState();
}
if (e.Key == Key.L && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
{
(AssociatedObject as DockingManager).LoadDockState();
}
};
}
} |