Alex141 / CalcBinding

Advanced WPF Binding which supports expressions in Path property and other features
Apache License 2.0
638 stars 79 forks source link

object reference not set to an instance of an object #69

Open LucaFagan opened 4 years ago

LucaFagan commented 4 years ago

I keep getting "object reference not set to an instance of an object" worning in xaml designer even if the application works fine.

If I replace win:Visibility.Visible and win:Visibility.Collapsed with numeric values the error goes away so I thing the error is related to the name space. Any solution ?

xmlns:win="clr-namespace:System.Windows;assembly=PresentationCore"

Visibility="{c:Binding '(JobParamsOtt.MULTIPLY_RIP_TYPE == 1) ? win:Visibility.Visible : win:Visibility.Collapsed'}">
keytrap-x86 commented 3 years ago

Try this :

xmlns:win="clr-namespace:System.Windows;assembly=PresentationCore"

Visibility="{c:Binding '(JobParamsOtt.MULTIPLY_RIP_TYPE == 1)'}">

If the condition is met, it wil be visible by default

LucaFagan commented 3 years ago

I've tried the suggested approach, if condition is met the field is visible, otherwise it is collapsed.

keytrap-x86 commented 3 years ago

I've tried the suggested approach, if condition is met the field is visible, otherwise it is collapsed.

I've edited my answer. I meant visible by default

LucaFagan commented 3 years ago

Ah ok.

Thanks for the explanation.