Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null-conditional operator support and null #49

Open
maurosampietro opened this issue Sep 25, 2017 · 3 comments
Open

Null-conditional operator support and null #49

maurosampietro opened this issue Sep 25, 2017 · 3 comments

Comments

@maurosampietro
Copy link

maurosampietro commented Sep 25, 2017

To calculate the visibilty of a control i'm using CalcBinding something like 'A?.B?.C > 0'.

I get a binding error saying "Value produced by BindingExpression is not valid for target property.; Value=''"

I also tried 'A != null and A.B != null and A.B.C > 0' but i can't get it to work.

So the question: is Null-conditional operator supported?
Is it null supported in comparisons?

Thanks

P.S. - A naive converter works just fine

public class CarouselVisibility : BaseConverter, IValueConverter
{
   public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
   {
       var vm = value as ViewModel;
       return vm?.A?.B?.C?.Count > 0 ? Visibility.Visible : Visibility.Collapsed;
   }
   public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
   {
      throw new NotImplementedException();
   }
}
@keytrap-x86
Copy link

keytrap-x86 commented Dec 13, 2020

Try

'A != {x:Null} and A.B != {x:Null} and A.B.C > 0'  

@maurosampietro
Copy link
Author

maurosampietro commented Dec 13, 2020 via email

@keytrap-x86
Copy link

I discovered CalcBindings yesterday. Hope it'll help some futur readers

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

No branches or pull requests

2 participants