这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@AhmadovMahammad
Copy link

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
Author

ISSUE #377

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.

1 participant