在GirdView中,某些列的文本应该靠右对齐。为此,我创建了一个包含TextBlock的DataTemplate。
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的绑定。如何访问该列的绑定?
发布于 2011-11-05 05:34:47
我也有同样的问题,所以我将TextAlignmentProperty公开为公共属性。
https://stackoverflow.com/questions/3281657
复制相似问题