MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Exception occurred while switching resource files

Open vipls007 opened this issue 7 months ago • 3 comments

Bug explanation

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:(no path); DataItem=null; target element is 'VisualBrush' (HashCode=4839561); target property is 'Visual' (type 'Visual')

Search the source code and locate the point

<Grid.OpacityMask> <VisualBrush> <VisualBrush.Visual> <MultiBinding Converter="{x:Static converters:FirstNonNullConverter.Instance}"> <Binding ElementName="ContentCoverBorder" /> <Binding Source="{x:Static DependencyProperty.UnsetValue}" /> </MultiBinding> </VisualBrush.Visual> </VisualBrush> </Grid.OpacityMask>

Not sure if it's correct

Version

5.2.1

vipls007 avatar Jun 10 '25 03:06 vipls007

Search the source code and locate the point

Image

vipls007 avatar Jun 10 '25 03:06 vipls007

I didn't confirm your particular problem myself, but the static referenced instances of the converters do indeed cause binding failures. We currently have this problem all throughout the library, however this should not affect your app or it's logic/behavior in any way.

Related issues: #3834 & #3814

corvinsz avatar Jun 10 '25 15:06 corvinsz

#3834 Consistent with this issue

Yes, it doesn't affect the overall logic, but this error can cause misunderstandings. In addition, I have a bit of OCD, and the reason why the problem must be solved is that I initially searched my own code but couldn't find this application. So I checked a third-party library and found that it was the problem with this library

From another perspective, the current issue has only been identified and has not affected the overall logic. However, in the future, as the functionality accumulates, this static reference may encounter problems that lead to logical errors. Fixing this issue will be a major undertaking

Your product is great, and I personally hope that this error can be fixed in the next version

vipls007 avatar Jun 11 '25 03:06 vipls007

Closing as a duplicate of #3834

Keboo avatar Jul 04 '25 04:07 Keboo