【问题标题】:WPF Datagrid IsReadOnly Property ErrorWPF Datagrid IsReadOnly 属性错误
【发布时间】:2012-10-18 13:48:46
【问题描述】:

我在 WPF 中定义了 datagrid,但我无法在 DataGridTextColumn 和 DataGrid 中设置 IsReadOnly 属性

  <dg:DataGrid  SelectionUnit="FullRow"    ColumnHeaderStyle="{StaticResource ColumnHeaderStyleByGiri}"  ItemsSource="{Binding QueuedTradesCollection}"  Margin="20"                  
    AlternationCount="2" RowStyle="{StaticResource RowStyle}"

                 VerticalGridLinesBrush="#FFADD8E6" 

                 HorizontalGridLinesBrush="#FFADD8E6" AutoGenerateColumns="False"
    Grid.RowSpan="1" x:Name="grdvw_trades" CellStyle="{StaticResource CellStyle}">

<dg:DataGridTextColumn IsReadOnly="true"     Header="Notional/PairOffAmount"   Width="120" ElementStyle="{StaticResource RightAlignStyle}" SortMemberPath="Notional"  DataFieldBinding="{Binding Notional,StringFormat={}{0:C}}"/>

我收到以下错误消息“无法设置属性 'DataGridColumn.IsReadOnly',因为它没有可访问的设置访问器”

【问题讨论】:

  • 你的 dg 命名空间指向什么?它是您正在使用的内置 WPF 数据网格还是自定义? DataGridTextColumn.IsReadOnly 通常具有可访问的集访问器。附带说明,DataGridTextColumn 将在 中设置
  • 我的 dg 命名空间指向 xmlns:dg="schemas.microsoft.com/wpf/2008/toolkit"。我正在使用内置的 wpf 数据网格。我在 中定义了我的列

标签: wpf


【解决方案1】:

我用的是 WPF TOOLKIT 2008,IsReadonly 属性只存在于 WPF Datagrid 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 2011-10-05
    • 1970-01-01
    • 2013-06-15
    • 2012-01-30
    相关资源
    最近更新 更多