List<string> UsedBy = new List<string>();
这是XamDataGrid代码
<igDP:Field Name="UsedBy">
<igDP:Field.Settings>
<igDP:FieldSettings >
<igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<ToggleButton x:Name="UsedByList" Content="Select Calibration tools" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:FieldSettings.CellValuePresenterStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
我希望能够在xamdatagridCell中显示切换按钮。 但是,当我使用我的代码时,DataGrid不显示此列。
如果我将UsedBy的类型更改为任何其他类型,例如int。列表DataGrid将显示UsedBy列。
我不明白为什么XamDataGrid无法识别List&lt;&gt;。
答案 0 :(得分:1)
just replace the field with UnboundField
<igDP:UnboundField Name="UsedBy">
<igDP:UnboundFField.Settings>
<igDP:FieldSettings >
<igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<ToggleButton x:Name="UsedByList" Content="Select Calibration tools" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:FieldSettings.CellValuePresenterStyle>
</igDP:FieldSettings>
</igDP:UnboundField.Settings>
</igDP:UnboundField>