WPF - 数据绑定的例子 [英] WPF - Data Binding Examples

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

问题描述

我试图环绕WPF绑定我的怀里。我觉得如果我能真正理解这是如何工作的,我可以利用WPF的优势。我最近碰到以下,在计算器上,真正帮助我理解结合一个具体的方面。它如下所示:

I am trying to wrap my arms around WPF binding. I feel like if I can really understand how this works, I can take full advantage of WPF. I recently came across the following, on StackOverflow, that really helped me understand one particular aspect of binding. It is as follows:

<ListView ItemsSource="{Binding AllRoles, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" Name="Hello">

这意味着:看看我的祖先,直到找到一个窗口,然后再寻找窗口名为AllRoles公共财产。即绑定到List

Which means: "Look at my ancestry until you find a Window, then look for a public property on the window called AllRoles". Bind that to the List.

有谁知道在哪里可以找到更多的非常简单的例子,像这样的解释?我发现这是非常有用的。

Does anyone know where I can find more very simple examples with explanations like this? I found this extremely useful.

推荐答案

<一个href=\"http://www.google.cz/url?sa=t&source=web&cd=1&ved=0CBoQFjAA&url=http%3A%2F%2Fwww.nbdtech.com%2FFree%2FWpfBinding.pdf&ei=LMdiTbvwI4mgOtiAobUN&usg=AFQjCNE3Ir6n9W-8twckhUA_c3DuO7Kvdg&sig2=bPsGOBF_wFaQL4oywoHwVg\"相对=nofollow> WPF数据绑定小抄

这为我做。它有一个数据绑定WPF的许多方面的例子。我一直一份印刷与我,当我与WPF开始,它确实帮助。

This did it for me. It has examples for most aspects of data binding in WPF. I kept a printed copy with me when I was starting with WPF and it really did help.

虽然90%我使用绑定的是简单的 {结合东西} {结合的ElementName = someElement} ,它的伟大知道所有的可能性。

Though 90% of bindings I use are simple {Binding Something} or {Binding ElementName=someElement}, it great to know all the possibilities.

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

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