在WPF MVVM中绑定数据 [英] Bind Data in WPF MVVM

查看:83
本文介绍了在WPF MVVM中绑定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Textblock中绑定数据?

当我在文本框中写入数据然后按下添加按钮,它将使用listview WPF MVVM绑定文本块中的数据?



参考此链接

How do I bind data in Textblock?
when I write data in textbox then press add button and it will be bind data in textblock using listview WPF MVVM ?

refer this link

Visit Question Its URL is http://www.c-sharpcorner.com/forums/bind-data-in-wpf-mvvm2

推荐答案

这很简单,只需创建一个字符串List(List< string>)。将craeted List绑定到ListBox的ItemsSource。只需按下按钮,只需将文本框的输入字符串添加到此列表中,它将反映在列表框中。
Hi, this is simple, just create a List of string (List<string>). Bind the craeted List to ListBox's ItemsSource. And just add your textbox's input string to this List whenever you press the button, it will reflects in the listbox.


这篇关于在WPF MVVM中绑定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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