绑定到不同类型的输入 [英] Bind to different types of input

查看:73
本文介绍了绑定到不同类型的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想允许用户以两种不同的方式输入数据,以便他可以选择一种更舒适的方式.我设计了一个TabControl,其中每个TabItem都提供一个GUI以不同的形式输入数据.

我当前的目标是使它们保持同步,并能够从代码以通用格式访问输入.

例如:

方法1:文本模式,单个文本框
方法2:多个带有标签的文本框

在代码中:

Hello,

I want to allow a user to input data in two different ways so he could choose a more comfortable one. I have designed a TabControl, where each TabItem presents a GUI to input data in a different form.

My current goal is to keep them in sync and be able to access the input in a common format from code.

Eg:

method 1: text-mode, a single text box
method 2: a number of labeled textboxes

in code:

var data = viewModel.Input; // whatever input mode was choosen by a user, this contains a coding-friendly data.



我应该创建两个都公开相同属性并实现转换器的用户控件,还是有更好(或更优选)的方法?

问候,
Jacek



Should I create two user controls which both expose the same property and implement converters or there is a better (or more preferable) way?

Greetings,
Jacek

推荐答案

不确定,但是ValueConverter可以帮助您吗?
Not sure, but maybe a ValueConverter can help?


这篇关于绑定到不同类型的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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