Ошибка в WPF? Столбец сетки не содержит полосу прокрутки ListBox - PullRequest
1 голос
/ 21 августа 2009

В следующем примере ширина самого левого столбца не увеличивается, чтобы вместить полосу прокрутки ListBox, которая появляется при уменьшении высоты UserControl:

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="Example">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Grid.ColumnSpan="2">Example text</TextBlock>
        <ListBox Grid.Row="1" Grid.Column="0">
            <ListBoxItem>One</ListBoxItem>
            <ListBoxItem>Two</ListBoxItem>
            <ListBoxItem>Three</ListBoxItem>
            <ListBoxItem>Four</ListBoxItem>
            <ListBoxItem>Five</ListBoxItem>
        </ListBox>
        <Expander Grid.Row="1" Grid.Column="1" Header="Expander" />
    </Grid>
</UserControl>

При удалении TextBlock с атрибутом ColumnSpan размер столбца изменяется, как и ожидалось. Это ошибка в WPF?

1 Ответ

1 голос
/ 21 августа 2009

Похоже, это известная ошибка с полосой прокрутки ListBox и сеткой WPF . Microsoft также отмечает, что они, вероятно, не исправят это в 4.0.

...