Solidworks Addin System.Windows.Data Error: 4
Posted: Mon May 17, 2021 2:39 am
Here occurs a error when I debug the AddIn, the error is like this:
I have tried remove all the combox tool in the WPF UI, but it still happens... From the error we got that the combox "Name='up_tol0'", this kind of name seems not my customized toolbox.
There is a old question is about the same questions, even the same name, is this a bug about soldiworks ?
>>>https://forum.solidworks.com/thread/65185
What's more, my addin if from SW template, and I create some WPF windows in it, after click the button in the Tab then the WPF window shown. Some time in using, the window freezing, I close the window, then I open the window again, the window would be blank window, till I restart solidworks it goes normal. I'm not sure about if it's caused by the above error.
It' seems about binding error of Combox component, but strange thing is that it happens on the first time I open a drawing, It's should not call any method to show or create the UI element, because I haven't click any button or initial any UI elements. I tried that if I open a model first rather than a drawing, that error would not occur.System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='up_tol0'); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='up_tol0'); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='dn_tol0'); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='dn_tol0'); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='up_tol0_Sec'); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='up_tol0_Sec'); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='dn_tol0_Sec'); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ComboBoxItem' (Name='dn_tol0_Sec'); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')
I have tried remove all the combox tool in the WPF UI, but it still happens... From the error we got that the combox "Name='up_tol0'", this kind of name seems not my customized toolbox.
There is a old question is about the same questions, even the same name, is this a bug about soldiworks ?
>>>https://forum.solidworks.com/thread/65185
What's more, my addin if from SW template, and I create some WPF windows in it, after click the button in the Tab then the WPF window shown. Some time in using, the window freezing, I close the window, then I open the window again, the window would be blank window, till I restart solidworks it goes normal. I'm not sure about if it's caused by the above error.