首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从FrameworkElementFactory获取绑定

从FrameworkElementFactory获取绑定
EN

Stack Overflow用户
提问于 2010-07-19 21:53:14
回答 1查看 782关注 0票数 4

在GirdView中,某些列的文本应该靠右对齐。为此,我创建了一个包含TextBlock的DataTemplate。

代码语言:javascript
复制
Binding bd = new Binding("path");

FrameworkElementFactory tbContent = new FrameworkElementFactory(typeof(TextBlock));
tbContent.SetBinding(TextBlock.TextProperty, bd);
tbContent.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Right);

DataTemplate dataTemplate = new DataTemplate();
dataTemplate.VisualTree = tbContent;

myGridViewColumn.CellTemplate = dataTemplate;

在另一个类中,我必须访问GridViewColumns的绑定。如何访问该列的绑定?

EN

回答 1

Stack Overflow用户

发布于 2011-11-05 05:34:47

我也有同样的问题,所以我将TextAlignmentProperty公开为公共属性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3281657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档