Posted 20 April 2023, 11:14 pm EST
Hello,
I’m using an old componentone C1Datagrid for WPF Version 3.0.20093.100.
As example:
grid:C1DataGrid x:Name=“DG_Lade_Aufträge” HorizontalScrollbarPlacement=“Bottom” AllowEdit=“True” BorderThickness=“2” BorderBrush=“#FF00A0F5” HeaderCellContentTemplate=“{StaticResource Grid_CLFont}” ItemCellShowContentTemplate=“{StaticResource Grid_OLFont}” ScrollViewer.HorizontalScrollBarVisibility=“Visible” HorizontalAlignment=“Left” Height=“Auto” Margin=“0,0,0,0” VerticalAlignment=“Top” Theme=“{DynamicResource {c1grid:C1ThemeKey ThemeName=MediaPlayer, TypeInTargetAssembly={x:Type c1grid:C1DataGrid}}}” GroupByCaption=“” GroupByVisibility=“Collapsed” AllowHierarchicalData=“False” AllowHorizontalSplit=“False” AllowHorizontalColumnSizing=“True” AllowVerticalSplit=“False” AllowVerticalSplitSizing=“False” SyncItemCellWidthToHeader=“True” AllowColumnMove=“False” AllowDelete=“False” HorizontalContentAlignment=“Center” VerticalContentAlignment=“Center” ForceCursor=“False” Foreground=“Silver” Width=“Auto” HeaderCellTextAlignment=“Center” NewRowPlacement=“None”>
c1grid:C1DataGrid.Columns
<c1grid:Column ReadOnly=“True” PropertyName=“Auftrag” ColumnName=“Auftrag” HeaderCellWidth=“135” HeaderCellContentTemplate=“{StaticResource Grid_CLFont}” ItemCellShowContentTemplate=“{StaticResource Grid_OLFont}” />
<c1grid:Column ReadOnly=“True” PropertyName=“Vorgang” ColumnName=“Vorgang” HeaderCellWidth=“140” HeaderCellContentTemplate=“{StaticResource Grid_CLFont}” ItemCellShowContentTemplate=“{StaticResource Grid_OLFont}” />
<c1grid:Column ReadOnly=“True” PropertyName=“Status” ColumnName=“Status” HeaderCellWidth=“120” HeaderCellContentTemplate=“{StaticResource Grid_CLFont}”>
c1grid:Column.ItemCellShowContentTemplate
<TextBlock.Style>
<Style.Triggers>
</Style.Triggers>
</TextBlock.Style>
</c1grid:Column.ItemCellShowContentTemplate>
</c1grid:Column>
The first column is “Auftrag”, second one “Vorgang” and so on. During runtime the quantity and the Index of Column depends of a result from a sql query.
That means actual first column should be the the fifth column after sql execute.
My question now: is there a posibility to change the position(index) of the Column by program like this:
if column.name = “Auftrag” then column(“Auftrag”).Index = 5
Many thanks for your help.
Best regards,
Chris