|
DockingManager.SetState(this.chid1, DockState.Dock);
|
|
/// <summary>
/// This event will raise when DockingManager is loaded
/// </summary>
void DockingManager1_Loaded(object sender, RoutedEventArgs e)
{
foreach (SidePanel panel in VisualUtils.EnumChildrenOfType(DockingManager1, typeof(SidePanel)))
{
if (panel.Name == "PART_LeftPanel")
{
panel.PreviewMouseDown += Panel_PreviewMouseDown;
break;
}
}
}
/// <summary>
/// This event will be raised when Mouse button is pressed.
/// </summary>
private void Panel_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
DockingManager.SetState(this.Content1, DockState.Dock);
}
|
|
private void Panel_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
panelname = (sender as SidePanel).Name;
Point point = new Point();
if (e is MouseEventArgs)
point = (e as MouseEventArgs).GetPosition(this);
HitTestResult hitTest = VisualTreeHelper.HitTest(this, point);
if (hitTest != null)
{
FrameworkElement visualHit = hitTest.VisualHit as FrameworkElement;
if (null != visualHit)
{
DependencyObject templatedParent = visualHit.TemplatedParent;
if (null != templatedParent
&& (templatedParent is ContentPresenter) || (templatedParent is TabItem))
{
switch(panelname)
{
case "PART_LeftPanel":
DockingManager.SetState(this.leftpanel, DockState.Dock);
break;
case "PART_RightPanel":
DockingManager.SetState(this.rightpanel, DockState.Dock);
break;
case "PART_BottomPanel":
DockingManager.SetState(this.bottompanel, DockState.Dock);
break;
}
}
}
}
}
|