Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How WPF uses MultiConverter to control Button status

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how WPF uses MultiConverter to control Button state". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how WPF uses MultiConverter to control Button state".

Requirement description

1. The state of the button needs to be judged by different combinations according to the contents of multiple data sources.

two。 The judgment rules for each data source can be customized.

Note: the following functions feel like a simple and rough implementation, if you know a more elegant solution, please let me know, thank you first!

Button XAML

The code is as follows:

MultiConverter judgment

The code is as follows:

Public class InvalidMultiValidationRuleToBooleanMultiConverter: IMultiValueConverter

{

# region IMultiValueConverter Members

Public object Convert (object [] values, Type targetType, object parameter, CultureInfo culture)

{

String [] paramlist = ((string) parameter) .split ('|')

If (paramlist = = null | | paramlist.Length

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report