编程在Silverlight结合 [英] Programmatic binding in Silverlight

查看:110
本文介绍了编程在Silverlight结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我错过了船的东西在这里,孩子们。这样可以使饲养它的头,我不知道发生了什么与怎么回事,所以我希望我的homeys在这里可以帮助。

在Silverlight中工作时,当我创建我的C#code绑定,他们从来没有托起应用程序运行时。从我的XAML中声明绑定看起来不错,但我做错了什么,当我创建我的C#绑定。我希望有一些言自明我失踪。下面是一个典型的绑定,被粉碎的:

 的TextBlock TB =新的TextBlock();
结合B =新的绑定(字号);
b.Source =这一点;
tb.SetBinding(TextBlock.FontSizeProperty,B);
 

解决方案

它看起来像Silverlight的3.1,至少,这不再是一个问题。我不能复制它,无论如何。

I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.

When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok, but I'm doing something wrong when I create my bindings in C#. I'm hoping that there is something blindingly obvious I'm missing. Here's a typical binding that gets crushed:

TextBlock tb = new TextBlock();
Binding b = new Binding("FontSize");
b.Source = this;
tb.SetBinding(TextBlock.FontSizeProperty, b);

解决方案

It looks like as of Silverlight 3.1, at least, this is no longer an issue. I can't reproduce it, at any rate.

这篇关于编程在Silverlight结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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