2016-04-29 97 views
0

我有以下定義的DataTemplates。 TextBlock的作品xctk:ShortUpDown沒有。事實上,每當我用的控制從另一個命名空間不會有工作(即顯示或更新Xceed Datagrid不會綁定到Xceed控件的DataTemplate

<DataTemplate x:Key="intDataTemplate"> 
     <TextBlock Text="{Binding StringFormat=\{0:F0\}}"/> 
    </DataTemplate> 
    <DataTemplate x:Key="hexDataTemplate"> 
     <xctk:ShortUpDown ParsingNumberStyle="HexNumber"/> 
    </DataTemplate> 

這些列定義中沒有數據,沒有可用的CellEditorTemplate。

  <xcdg:Column FieldName="Coefficient" Width="75" 
         CellContentTemplate="{StaticResource hexDataTemplate}" ReadOnly="False"/> 
      <xcdg:Column FieldName="Measured" Width="75" CellHorizontalContentAlignment="Right" 
         CellContentTemplate="{StaticResource intDataTemplate}" /> 

剛似乎沒有很多的例子代碼在那裏。這些列是自動生成的。

任何建議表示讚賞。

回答

0

的CellContentTem板僅用於顯示目的。如果你在其中放置了一個用於編輯的控件,比如ShortUpDown,你會得到奇怪的結果。 編輯器控件應該在CellEditor中定義。此外,不要忘記設置CellEditorBinding將其連接到基礎值。

<xcdg:CellEditor x:Key="hexCellEditor"> 
    <xcdg:CellEditor.EditTemplate> 
     <DataTemplate> 
      <xctk:ShortUpDown Value="{xcdg:CellEditorBinding}" ParsingNumberStyle="HexNumber"/> 
     </DataTemplate> 
    </xcdg:CellEditor.EditTemplate> 
</xcdg:CellEditor> 

<xcdg:Column FieldName="Measured" CellEditor="{StaticResource hexCellEditor}" ... /> 
相關問題