Sunday, April 25, 2010

Showing a button in Xceed DataGridView column

image

Want to have a button in a Grid?

3 things are here:

  1. Grid definition
  2. column definition
  3. Template for button

 

 

1. Grid: <xcdg:DataGridControl x:Name="mGrid" />

2. Columns:

<xcdg:DataGridControl.Columns>
<
xcdg:Column FieldName="MyThing" Title="Things"
VisiblePosition="0"/>
<xcdg:Column FieldName="." Title="Action" MinWidth="100" MaxWidth="200" CellContentTemplate="{StaticResource ActionButtons}"/>
</
xcdg:DataGridControl.Columns>



3. and the actual template:<UserControl.Resources>

   <
DataTemplate x:Key= "ActionButtons">

     <
StackPanel Orientation="Horizontal">

       <
Button Content="{BindingNextAction}" DataContext="{Binding}" IsEnabled="{Binding Enabled}"Click="NextAction_Click">

     </
StackPanel>

   </
DataTemplate>

</
UserControl.Resources>




 


0 comments:

Post a Comment