Skip to content

Fix: binding errors in Generic.xaml for VS2013 theme#507

Open
AhmadovMahammad wants to merge 1 commit into
Dirkster99:masterfrom
AhmadovMahammad:fix-vs2013-theme-binding-errors
Open

Fix: binding errors in Generic.xaml for VS2013 theme#507
AhmadovMahammad wants to merge 1 commit into
Dirkster99:masterfrom
AhmadovMahammad:fix-vs2013-theme-binding-errors

Conversation

@AhmadovMahammad
Copy link
Copy Markdown

Fix: Resolve XAML binding errors in VS2013 theme

Fixed XAML binding errors in Generic.xaml that were causing "Cannot find governing FrameworkElement" errors.
The issue occurred in the AnchorablePaneTitle and LayoutAnchorableFloatingWindowControl styles, where the GeometryDrawing
was using an ElementName binding to reference DragHandleGeometryPlaceholder's Fill property.

Solution: Replaced the element bindings with direct DynamicResource references to the same resource keys.


The issue is caused in ./Themes/Generic.xaml in two styles:

  1. <Style TargetType="avalonDockControls:AnchorablePaneTitle">
  2. <Style x:Key="{x:Type avalonDockControls:LayoutAnchorableFloatingWindowControl}" TargetType="{x:Type avalonDockControls:LayoutAnchorableFloatingWindowControl}">

Both styles contain a GeometryDrawing element that attempts to bind to the Fill property of another element named "DragHandleGeometryPlaceholder" using an ElementName binding, which fails due to element relationship issues in the visual tree.

Solution

Fixed the problem by replacing the ElementName bindings with direct resource references:

Changed

<GeometryDrawing Brush="{Binding Fill, ElementName=DragHandleGeometryPlaceholder, Mode=OneWay, Converter={avalonDockConverters:NullToDoNothingConverter}}">

To:

<GeometryDrawing Brush="{DynamicResource {x:Static reskeys:ResourceKeys.ToolWindowCaptionInactiveGrip}}">

Testing

Tested with .NET 6 and VS2022
Confirmed binding errors no longer appear
Verified that theme styling appears correctly

Fixed binding errors in Generic.xaml causing 'Cannot find governing FrameworkElement'
errors. Replaced ElementName bindings with direct resource references in AnchorablePaneTitle
and LayoutAnchorableFloatingWindowControl styles.

ISSUES Dirkster99#337: Binding failure when using AvalonDock.Themes.VS2013 Dirkster99#377
Changes: 1. Line number: 2161, 2. Line number: 619
@AhmadovMahammad
Copy link
Copy Markdown
Author

ISSUE #377

@sharpSteff
Copy link
Copy Markdown
Collaborator

@AhmadovMahammad Thanks for the PR. Unfortunately the diff is too big too review (probably styling). Can you simplify it?

Copy link
Copy Markdown
Collaborator

@sharpSteff sharpSteff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff too big

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants