0

In a WPF application, I've the following in XAML:

<DockPanel Background="Black">
        <ListView DockPanel.Dock="Top" ItemsSource="{Binding TestSteps}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Background="LightPink">
            <ListView.View>
                <GridView>

                    <GridViewColumn Header="" Width="Auto">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <fa:ImageAwesome Icon="{Binding IconType}" Foreground="{Binding Status}" SpinDuration="2" Width="10" VerticalAlignment="Center" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>

                    <GridViewColumn Header="#" Width="Auto" DisplayMemberBinding="{Binding SerialNumber, StringFormat='00'}" />

                    <GridViewColumn Header="Action" Width="Auto">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Action}" TextWrapping="Wrap" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

</DockPanel>

I want the 3rd column to stretch to as right as its parent let it to be. The text of this column should wrap to avoid the necessity of horizontal scrollbar.

This is what it looks like when I launch the program:

enter image description here

When I stretch the window horizontally, an unwanted column appears.

enter image description here

Instead of the appearance of the unwanted column, what I want is the 3rd column should take the available horizontal space.

How can I achieve that?

Donotalo
  • 12,748
  • 25
  • 83
  • 121
  • The `Width` of your Action `GridViewColumn` is not updating when the Window is resized. You could bind its width to the `DockPanel`s `ActualWidth`to strecth it dynamically (eg. replace `Auto`with `{Binding RelativeSource={RelativeSource AncestorType=DockPanel}, Path=ActualWidth}`) – LittleBit Oct 04 '18 at 06:39
  • @LittleBit: Thanks. I've already incorporated `ListViewLayoutManager`, found in the link of duplicate question. – Donotalo Oct 04 '18 at 07:03

0 Answers0