Disable the docking containerSplitter fo the docksite.

Docking/MDI for WPF Forum

Posted 12 years ago by keshav bansal
Version: 12.1.0562
Avatar

How to Disable the docking containerSplitter fo the docksite ?

As i can easily disable the containersplitter  but it will disable the container splitter for all the docksite.

<Style  TargetType="docking:ContainerSplitter">

<Setter Property="IsEnabled" Value="False" />

</Style>

Suppose i created the application using the pismIntegartion with docking that consist of four docksites named Docksite1,Docksite2,Docksite3,Docksite4.

and Docksite4 consist of two toolwindows so its automatically will show the container splitter between the toolwindows of the Docksite4.I want to Disable the docking containerSplitter fo the docksite4 but it should be enable for the remaining docksites i.e. for the Docksite1 and the Docksite2 and the Dopcksite3.

I use the key concept for the style like

<Style x:Key="dockingSplitter"  TargetType="docking:ContainerSplitter">

<Setter Property="IsEnabled" Value="False" />

</Style>

and apply it on the Docksite4

<docking:DockSite x:Name="Docksite4"  Style="{StaticResource dockingSplitter}" docking:DockSite> But its showing the exception.

Exception:----

{"'ContainerSplitter' TargetType does not match type of element 'DockSite'."}  ('Set property 'System.Windows.FrameworkElement.Style' threw an exception.' Line number '119' and line position '47'.)

Comments (3)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Keshav,

You can't assign that Style to the DockSite.Style property since it doesn't target DockSite.  You need to take the implicit Style and put it in the DockSite.Resources for Docksite4.


Actipro Software Support

Posted 12 years ago by keshav bansal
Avatar

Hi,

I am applying the Implicit style used below by applying the key to the implicit style and programatically applying the style to the SplitContainer.

<Style x:Key="dockingSplitter" TargetType="{x:Type dockingPrimitives:Splitter}"><Setter Property="Background" Value="Transparent" /><Setter Property="BorderBrush" Value="Transparent" /><Setter Property="BorderThickness" Value="1" /><Setter Property="IsEnabled" Value="false"/><Setter Property="PreviewBrush" Value="{DynamicResource {x:Static dockingThemes:DockingResourceKeys.SplitterPreviewBrushKey}}" /><Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" /><Setter Property="SnapsToDevicePixels" Value="True" /><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type dockingPrimitives:Splitter}"><Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True"><Border Margin="{TemplateBinding Padding}" BorderBrush="{TemplateBinding InnerBorderBrush}"BorderThickness="{TemplateBinding InnerBorderThickness}" SnapsToDevicePixels="True" /></Border></ControlTemplate></Setter.Value></Setter></Style><!-- dockingPrimitives:ContainerSplitter --><Style x:Key="DockingSplitterDisable" TargetType="{x:Type dockingPrimitives:ContainerSplitter}" BasedOn="{StaticResource dockingSplitter}" />

But Exception is coming ContainerSplitter' TargetType does not match type of element 'SplitContainer'.

Code used is below

List<ToolWindow> twlist = (sender asDockSite).ToolWindows.ToList();

foreach(ToolWindow tw intwlist){

ToolWindowContainer tcontainer = tw.ParentContainer asToolWindowContainer;

SplitContainer scontainer = tcontainer.Parent asSplitContainer;

if (scontainer != null)

{

scontainer.SetResourceReference(SplitContainer.StyleProperty, "DockingSplitterDisable");}

}

Exception is coming ContainerSplitter' TargetType does not match type of element 'SplitContainer'.

 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Second thing is if i am getting the ContainerSplitter from the tcontainer then am always getting null  value as specified in the belowed code.

ContainerSplitter scontainer = tcontainer.Parent asContainerSplitter;

[Modified 12 years ago]

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Keshav,

As the WPF exception says, you are making a ContainerSplitter control style and putting it as the style of a SplitContainer.  SplitContainer and ContainerSplitter controls are different control types so that is not a valid operation.  One is a container used for other docking container layouts, and the other is a splitter.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.