这是对IValueConvertor的错误使用吗? [英] Is this wrong use of IValueConvertor?

查看:67
本文介绍了这是对IValueConvertor的错误使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下示例课

I have the following sample class

设备类
{
字符串状态; <​​br/> };

我希望我的UI显示以下内容

设备
当前状态:开
[表示与On(ex:Off)相反的按钮]

class Device
{
string status;
};

I want my UI to display the following

Device
Current Status: On
[ Button That says the opposite of On( ex: Off ) ]

在我的按钮上使用值转换器以使其在当前设备值打开时显示为关闭",反之亦然吗?

Is it bad practice to use a value convertor for my button to make it display Off when the current device value is On, and vice versa?

执行此操作的推荐方法是什么?

What is the recommended way of performing this?

推荐答案

这就是ivalueconverters的用途.我认为可以使用.

that is what ivalueconverters are for.  I that that use is ok. 


这篇关于这是对IValueConvertor的错误使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆