首页 文章
  • 10 votes
     answers
     views

    WPF - 如何从DataGridRow获取单元格?

    我有一个数据绑定的DataGrid与交替的行背景颜色 . 我想根据它包含的数据对单元格进行不同的着色 . 我已经尝试过这个线程建议的解决方案 http://wpf.codeplex.com/Thread/View.aspx?ThreadId=51143 但, DataGridCellsPresenter presenter = GetVisualChild(row) 始终返回null . 我在用 ...
  • 0 votes
     answers
     views

    在代码中创建controltemplate,如何在绑定中指定转换器

    我检查了这些答案,但没有人得到我正在寻找的信息:How to setup a WPF datatemplate in code for a treeview?How to set Control Template in code?Create ControlTemplate programmatically in WPF 这是我的代码的要点: DataGridTextColumn col = ne...
  • 1 votes
     answers
     views

    WPF DataGrid单元格文本环绕 - 设置为NoWrap(False)

    如何将WPF DataGrid中每个单元格的TextWrapping设置为“NoWrap”?我理解Cell本身没有“TextWrapping”属性,但我想在单元格中的控件上设置属性 . 我正在使用的DataGrid没有显式定义列,它显示的结果集是动态的 . 我正在寻找类似于以下链接中提供的答案的解决方案 . 但是,我不想显式覆盖单元格样式/模板并定义要使用的控件 . 相反,我想说,如果正在使用Te...
  • 2 votes
     answers
     views

    将单元对象的属性绑定到WPF DataGrid中的DataGridCell

    使用WPF DataGrid我需要根据单元格对象属性的相关值更改DataGridCell的各种显示和相关属性 - 例如Foreground,FontStyle,IsEnabled等 . 现在这在代码中很容易做到(例如(使用ObservableDictionaries的Observable Collection): var b = new Binding("IsLocked") ...
  • 4 votes
     answers
     views

    WPF DataGrid绑定DataGridCell内容

    希望这将是一个非常简单的答案,我只是没有看到我认为的树木的谚语 . 我有一个DataGridCell样式,我希望将单元格的内容绑定到图像的source属性,这里是我现在使用的XAML: <Style x:Key="DataGridImageCellStyle" TargetType="{x:Type toolkit:DataGridCell}">...
  • 0 votes
     answers
     views

    WPF DataGrid文本垂直对齐

    我正在使用WPF DataGrid . 我正在尝试获取DataGridTextColumns的内容以垂直居中显示的文本 . 目前,我的单元格值如下所示:http://imgur.com/nkbE7Wt . 如您所见,它们垂直对齐到单元格的顶部 . 我尝试将模板添加到我的DataGridCells的样式,这是有效的,它使文本居中如下:http://imgur.com/TCo6RCa . DataG...

热门问题