Set the different style of dockguide in different docksites

Docking/MDI for WPF Forum

Posted 12 years ago by keshav bansal
Version: 12.2.0570
Avatar

Hi,

How to Set the different style of dockguide in different docksites ?

I am able to change the implicit style for the dockguide but its applying on the whole application but that sholuld not happen.

ForExample:If my application consists of two docksites named docksite1 and docksite2 then default dockguide should be diplayed in the docksite2 while docking the toolwindow in thw docksite1 and custom ao changed dockguide style should be displayed in docksite2 while docking the toollwindow in the docksite2.

Comments (7)

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

Hi Keshav,

You should make sure your implicit styles go each DockSite's Resources as appropriate instead of the Application's Resources.


Actipro Software Support

Posted 12 years ago by keshav bansal
Avatar

Hi,

But DockGuide style consists of number of based style like dockguideTop,dockguidebottom,dockguideRight,dockguideLeft,dockguideCross and each having its Key that is defined in the implicit style  so should i change the key of ech above five styles?

I am not able to set the Resources of the docksite because the dockguide style is also based on the DockguideBrush style..?

If i use it in Docksite.Resources then i am getting exceeption like below.

'Resources' property has already been set on 'DockSite'

I am using like

<docking:DockSite x:Name="StatusDocksite" Background="#6682b0"CanToolWindowsDockBottom="False" CanToolWindowsDockLeft="False" CanToolWindowsDockRight="False" CanToolWindowsDockTop="False"><docking:DockSite.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionary Source="D:\IT2\Recording Workstation Software\LabSystem\Assets\Resources\DockGuides.Brushes.xaml" /></ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

<!-- dockingPreview:DockGuideBottom -->

so on fo other directions/..................

[Modified 12 years ago]

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

Please look on the internet for more information on what implicit styles are.  They are styles that target a type without the x:Key specified.  That allows them to be applied to elements of the target type.  You would need to make implicit styles for all the dock guide types you listed.

If the styles have StaticResource dependencies on other things like brushes, you'll need to copy or change those as well.

Also you should look in the internet for more information on how to properly include resources in an element.  You are combining a XAML-based dictionary and loose resources as well here, which you can do but I think everything needs to be in MergedDictionaries in that case.  The internet has a lot of information on this sort of WPF concept and can help you.


Actipro Software Support

Posted 12 years ago by keshav bansal
Avatar

Hi,

As i am able to set the resouces of the the particular docksite.

ForExample:

<docking:DockSite.Resources>

<ResourceDictionary><ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="D:\IT2\Recording WorkstationSoftware\LabSystem\Assets\Resources\Dictionary1.xaml"></ResourceDictionary>

</ResourceDictionary.MergedDictionaries></ResourceDictionary>

</docking:DockSite.Resources>

and this Dictionary1.xaml consists of the my changed implicit styles of the four Dockguide Directions(Left,Right,Top,Bottom) and style for the DockguideCross but all these five styles having the TargetType of Dockguide Not of Docksite ,thats why they are not applying on the Dockguide.

 

So how to specifies that Dockguide displayed in this Docksite should follow or should have the styles specified in my Resource dictionary. 

 

Which means we normally use resources to specify that style for that element(Docksite) will be in this resource file and this resource file will consists of the style of Target type with same element(Docksite).But in our case we set the resources of our Docksite but that there is no style having the TargetType as Docksite.

[Modified 12 years ago]

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

Sorry but I'm not quite sure what you mean.  When you create a Style for a control type, you need the TargetType to be that control type.  That is a fundamental basic principle of WPF.  You should never set a TargetType to DockSite for something other than a Style for the DockSite control.

Your implicit styles should be something like:

<Style TargetType="{x:Type docking:DockGuideBottom}">...</Style>

If those don't take effect where you have them then you might need to put them at a higher level like Application.Resources.  You may need to do that since unless you are doing hosted rafting windows (not the default), DockGuides open up in their own windows, so DockSite resources may not flow down to them.  Sorry we should have thought of that in our original reply.  Thus if you aren't doing hosted rafting windows (meaning they can't exit the DockSite area and probably is not what you want for your app), then you probably can't style dock guides differently for different DockSites.


Actipro Software Support

Posted 11 years ago by keshav bansal
Avatar

ForExapmle i Have Four Docksites in the application named Docksite1,Docksite2,Docksite3 and Docksite4 and each having toolwindows named toollwindow1 ,toolwidnow21,toolwindow3,toolwindow4 respectively,These Docksites are linked to each other which means any toolwindow can be docked in the any of the Docksites.

Requirement is like Dockguides displayed in the Docksite1,Docksite2 and Docksite3 should be the default DockGuide and the DockGuide displayed in the Docksite4 should be the Customized DockGuide

If i put the Customized Dockguide Code in the App.Resources then its applying to all the Docksites which means customized dockGuide is dispalying in all four Docksites.

If i put the Customized Dockguide Code in the DockSite.Resources then its Not  applying to that Docksites which means customized dockGuide is not  dispalying in that  Docksites.

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

That is correct and the reason is explained in the last paragraph of our previous reply.  Based on what we described, unfortunately there probably isn't a way to style the dock guides separately for different DockSites.


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.