How to customize DockGuideCross's Style so Buttons align on the controls edges?

Docking/MDI for WPF Forum

Posted 10 years ago by Anargyros Tomaras
Version: 13.1.0580
Avatar

I am trying to completely restyle the DockGuideCross. I have created an implicit style for it in my App.xaml in order to override the default one.
What i want to have is an invisible DockGuide with subtle transparent HitMarks on the edges of the current dockable control. 

When HorizontalAlignment and VerticalAlignement are set to center (the default) on the DockGuideCross then the guides are correctly centered to the current dock target. BUT when i set them to Stretch then the DockGuide's Grid area extends well beyond the current dock target's visible area (even covering parts of sibling ToolWindowContainers). This means that i cannot position my new HitMarks correctly on the left and right edges of the current docktarget.

Unfortunately this editor does not support screenshots which would make my explanation a lot easier.

<Style TargetType="{x:Type dockingPreview:DockGuideCross}">
        <Setter Property="Control.Background"
                Value="{DynamicResource {x:Static themes:AssetResourceKeys.ContainerMediumEndBackgroundNormalBrushKey}}" />
        <Setter Property="Control.BorderBrush"
                Value="{DynamicResource {x:Static themes:AssetResourceKeys.ContainerBorderNormalBrushKey}}" />
        <Setter Property="Control.BorderThickness"
                Value="1" />
        <Setter Property="FrameworkElement.HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="FrameworkElement.VerticalAlignment"
                Value="Stretch" />
        <Setter Property="UIElement.SnapsToDevicePixels"
                Value="true" />
        <Setter Property="Control.Template">

[Modified 10 years ago]

Comments (9)

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

Hello,

The layout code for the dock guides is such that they will be measured and then it will try and center them over the target locations we determine. Sometimes their locations can make them extend beyond the actual size of the target container when the container is small.  I don't think that would work properly if we only aligned them to the container bounds.  Unfortunately I'm not sure it's possible to do what you are trying to do with how the internal layout logic for them is.


Actipro Software Support

Posted 10 years ago by Anargyros Tomaras
Avatar

I can understand that the DockGuideCross's surface might be sqeezed in a small enough container but in my case there is plenty of room for everything. My workspace has 600px of real "visible" horizontal real estate. Why would the DockGuideCross's surface need more than 600px when Hor/VerAlign is stretch?

Is there a way for me to workaround the issue? Can i maybe traverse the VisualTree upwards to find out the actual container size?

Thats the only thing left for me to solve and we can use it!

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

I'm talking about when a container (like tool window container) is sized small.  There are many cases where the dock guides don't fit over a container.

It would be helpful if you send us a new simple sample project that shows the problem you are having.  Then we can debug it and see if there is any suggestion we can make to help.  If you would like to send us something, please email our support address with the sample, rename the .zip file extension so it doesn't get spam blocked, and reference this thread.  Thanks!


Actipro Software Support

Posted 10 years ago by Anargyros Tomaras
Avatar

Ticket Number: 27D-1AEAB9D3-0404 has been created.

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

Hello,

Thanks for the sample.  We did some reworking of our internal dock guide layout logic and were able to get it working how you need.  These changes will be in the next maintenance release.


Actipro Software Support

Posted 10 years ago by Anargyros Tomaras
Avatar

That sounds great! Thank you, Any idea when that will be approximately?

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

It might be several weeks yet since we are still collecting updates.  If you would like to try a preview build earlier than that to test it, feel free to reply back to the private ticket to request one.


Actipro Software Support

Posted 10 years ago by Anargyros Tomaras
Avatar

Tested the preview build and works like a champ!

I have some more questions.

Lets say i have a single workspace with dockable areas on the left and right only.
Lets say i also have 2 ToolWindows docked on the left and right.
The only HitMarks that make sense in my CanDockLeft and CanDockRight setup are
1) the DockGuideLeft 
2) the DockGuideRight
3) and ONLY the DockGuideCross of the center workspace. 

DockGuideCrosses and HitMark previews appear for my ToolWindows as well though (when the mouse drag is over them).

So, is there a way i can disable the DockGuideCrosses for my ToolWindows and keep it enabled for my Workspace only?

[Modified 10 years ago]

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

I'm glad to hear the updates fixed the problem with the adorner layouts.

Sorry but we don't have a way for you to alter the logic on which dock guides appear.


Actipro Software Support

The latest build of this product (v24.1.3) 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.