WPF Property Data binding to negate the property

后端 未结 4 1735
忘掉有多难
忘掉有多难 2020-12-16 10:13

Is there any way to change the value of property at runtime in WPF data binding. Let\'s say my TextBox is bind to a IsAdmin property. Is there anyway I can change that prope

4条回答
  •  一整个雨季
    2020-12-16 10:30

    If you specifically want to do this at XAML end (I am not sure the reason for that, unless you have 100s of similar operation of negate) there are only two ways 1) Using IValueConverter 2)write a XAML Markup Extension (Way too much work for this small task :))

    Then the other obvious way is to write another property in your ViewModel , which can return the Negative of the IsAdmin property.

提交回复
热议问题