0

I have a page in my wpf app where I have multiple devexpress grids rendered (Grid1, Grid2, Grid3 etc) via an items control and would like to make sure that their columns (Column1, Column2, Column3) are rendered the same width initially. For example: Column1 has always the same width in Grid1, Grid2 and Grid3 and Column2 has always the same width in Grid1, Grid2 and Grid3 regardless of what data they are showing.

How can I achieve this?

            <ItemsControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" 
                      x:Name="Grids" Margin="-5,0,0,0"
                      ItemsSource="{Binding Items, Mode=TwoWay}" 
                      Background="Transparent"
                      BorderThickness="0"
                      Grid.IsSharedSizeScope="True"
                      ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                      ScrollViewer.VerticalScrollBarVisibility="Auto">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border BorderThickness="1" BorderBrush="Black" Margin="10,5,0,25" Width="Auto" MinWidth="750">
                                <dxg:GridControl MaxHeight="250" MinHeight="100" MinWidth="700"
                                                 ItemsSource="{Binding Statuses}"                                                   
                                                 AutoGenerateColumns="None" SelectionMode="None">
                                    <dxg:GridControl.Columns>
                                        <dxg:GridColumn Header="Column1" FieldName="Field1" UnboundType="Object" SortIndex="0" AllowSorting="True"  ReadOnly="True" />
                                        <dxg:GridColumn Header="Column2" FieldName="Field2" UnboundType="Object" ReadOnly="True"  SortIndex="1" SortMode="Value" Binding="Field2" />
                                    </dxg:GridControl.Columns>
                                </dxg:GridControl>
                                <!-- Code left out for brewity sake... -->
                        </Border>
                    </DataTemplate>                        
                </ItemsControl.ItemTemplate>
            </ItemsControl>
gyurisc
  • 11,234
  • 16
  • 68
  • 102
  • Maybe I do not understand... but you have Width="70" and Width="300" ?!? – Nawed Nabi Zada Sep 09 '19 at 11:22
  • Sorry for not being clear. What I want is to make sure that column A in table 1, table 2, table 3 are always the same width, column B in table 1, 2, 3 always the same and so on regardless of what data the table 1, 2, 3 is rendering. I am going to update my code sample and my question thanks for taking the time and making the effort to clarify :) – gyurisc Sep 09 '19 at 12:52

0 Answers0