This project has moved. For the latest updates, please go here.

simple questions

Oct 14, 2014 at 8:58 AM
  • how can i change the rowheight of the datagrid
  • how to hide the group bar on the top
  • how to hide the left row idicator
thanks and good day
Oct 14, 2014 at 1:01 PM

1) RowHeight of DataGrid :
Depending on which type of View you are using on the DataGridControl, there are two ways of doing what you wish.

For the TableView, simply set the Style of the DataRow elements to have the Height you need.
<Style TargetType="{x:Type xcdg:DataRow}">
      <Setter Property="Height" Value="40" />
For the TableflowView, set its ContainerHeight value to the desired height.
      <xcdg:TableflowView ContainerHeight="40" />
2) Hide GroupByControl
By default, the view in the grid has a FixedHeader containing a groupByControl and a ColumnManagerRow. To remove the GroupByControl, you need to disable the default FixedHeader and create your own :
            <xcdg:TableflowView UseDefaultHeadersFooters="False">
                     <xcdg:ColumnManagerRow />
3) Hide RowSelectorPane
You can use the property ShowRowSelectorPane from the View :
            <xcdg:TableflowView  ShowRowSelectorPane="False">
Oct 14, 2014 at 4:50 PM
Edited Oct 14, 2014 at 5:09 PM
worked like a charm !

another questions :):
1) in the standard datagrid i can add a DataGridTemplateColumn and add whatever i want : several bounded fields, action controls ... etc .
how to do the same thing in the toolkit DG please ?

2) i want to style the datarow to add a rounded border container, something like this
i have tried this :
   <Style x:Key="DataRowStyle2" TargetType="{x:Type xcdg:DataRow}">

            <Setter Property="Height" Value="80" />
            <Setter Property="MinHeight" Value="80" />
            <Setter Property="Template">
                    <ControlTemplate TargetType="{x:Type xcdg:DataRow}">
                        <Border Background="Green">
                            <ContentPresenter HorizontalAlignment="Center"
i got the green border but without the content XD
Oct 14, 2014 at 6:48 PM

1) DataGridTemplateColumn on Xceed DataGrid :
You can set the property you want on the Column individually :
<xcdg:DataGridControl x:Name="_datagrid" >
            <DataTemplate x:Key="FirstNameCellContentTemplate">
               <StackPanel Width="20"
                  <Border Background="LightBlue"
                     <TextBlock Text="{Binding}"
                                HorizontalAlignment="Center" />
            <DataTemplate x:Key="FirstNameCellEditorTemplate">
                 <TextBox Text="{xcdg:CellEditorBinding}"
                          Background="Green" />
            <xcdg:Column FieldName="FirstName"
                                    CellContentTemplate="{StaticResource FirstNameCellContentTemplate}">
                  <xcdg:CellEditor EditTemplate="{StaticResource FirstNameCellEditorTemplate}" />
2) Have DataRows with Green Background and rounded borders :
Re-template the DataRow (xcdg:FixedCellPanel based on default DataRow Template):
<Style TargetType="{x:Type xcdg:DataRow}">
               <Setter Property="Template">
                     <ControlTemplate TargetType="{x:Type xcdg:DataRow}">
                        <Border Background="Green"
                           <!-- The PART_CellsHost part designates the Panel to which this Row's Cells should be added.-->
                           <xcdg:FixedCellPanel x:Name="PART_CellsHost"
                                                ColumnStretchMinWidth="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).ColumnStretchMinWidth}"
                                                ColumnStretchMode="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).ColumnStretchMode}"
                                                FixedCellCount="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).FixedColumnCount, Mode=TwoWay}"
                                                FixedColumnDropMarkPen="{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).FixedColumnDropMarkPen}"
                                                Margin="{TemplateBinding BorderThickness}" />
Complete doc for Xceed DataGrid can be found here :
Oct 14, 2014 at 7:32 PM
Edited Oct 14, 2014 at 7:42 PM
duplicated , please delete
Oct 14, 2014 at 7:41 PM
now suppose that the datagrid control is bound to and Orders List .
i may add a Customer column field wich is a navigation property of the order object to add customer personal info: name, phone ... etc .
it would work with code above .
but the problem is Sorting
how can i tell to the datagrid to sort the orders by CUSTOMER.FirstName when i click the CUSTOMER column, because it cannot sort by the navigation property object itself .

2) again it worked ,
just need to adapt this to use the itemscontainer template, a little sleepy right now :)

anyway thanks for your assistance ... really appreciate !
Oct 15, 2014 at 1:13 PM

1) Sorting Customer.FirstName.
Sorting is done on the FieldName of the Column. If the fieldName is "Customer", you can use a CellContentTemplate to display Customer.FirstName or Customer.LastName, but sorting will be done on Customer (DataGrid won't know how to sort). You could use DataGridItemProperties and add a SortComparer like examples here :

But in the end, it is now the best option. Its is better to use 1 column per property : Column1.FieldName = Customer.FirstName, Column2.FieldName = Customer.LastName...This way, sorting will work and all DataGrid options willl work (inserting Customer.FirstName instead of Customer, filtering by Customer.FirstName instead of by Customer, editing Customer.FirstName instead of Customer...). You will not by pass the DataGrid's provided technology.