0

誰かが私のコードの何が問題なのか知っていますか:

<Border Background="AliceBlue" BorderThickness="2">
    <Grid Name="MainGrid" Background="DarkGray" >
        <Grid.RowDefinitions>
            <RowDefinition Height="0.02*"/>
            <RowDefinition Height="0.07*"/>
            <RowDefinition Height="0.63*"/>
            <RowDefinition Height="0.05*"/>
            <RowDefinition Height="0.05*"/>
        </Grid.RowDefinitions>   

        [...SNIP...]

           <StackPanel Grid.Row="2">
            <Expander Header="Filteroptionen" Foreground="WhiteSmoke" FontWeight="Bold">
                <Border Margin="18,10,18,10" Name="border1" CornerRadius="10,10,10,10" Background="Gray" >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <StackPanel Margin="15,5,5,5" Grid.Column="0">
                            <RadioButton FontWeight="Normal" Foreground="White" Height="19" Name="radtest1">test1</RadioButton>
                            <RadioButton FontWeight="Normal" Foreground="White" Height="19" Name="radtest2">test2</RadioButton>
                            <RadioButton FontWeight="Normal" Foreground="White" Height="19" Name="radtest3">test3</RadioButton>
                        </StackPanel>
                            <StackPanel Margin="15,5,5,5" Grid.Column="1">
                                <my:DatePicker HorizontalAlignment="Left" Height="25" Name="datePicker1" Width="115" Text="Von" />
                                <my:DatePicker HorizontalAlignment="Left" Height="25" Name="datePicker2" Width="115" Text="Bis" IsEnabled="True" />
                            </StackPanel>
                            <StackPanel Margin="15,5,5,5" Grid.Column="2">
                                <WrapPanel>
                                    <Label FontWeight="Normal" Foreground="White" >Number</Label>
                                    <TextBox FontWeight="Normal" Width="193"></TextBox>
                                </WrapPanel>
                                <WrapPanel>
                                    <Label FontWeight="Normal" Foreground="White" >Name</Label>
                                    <TextBox FontWeight="Normal" Width="250"></TextBox>
                                </WrapPanel>

                            </StackPanel>

                        </Grid>
                </Border>
            </Expander>
                    <Border Margin="18,10,18,10" CornerRadius="10,10,10,10" Background="Gray" >
                        <my:DataGrid Margin="10,10,10,10" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="auto" ItemsSource="{Binding}" Name="mainDataGrid" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" />
                </Border>
            </StackPanel>

問題を示す画像をここに添付しました(スクロールバーが正しく表示されず、グリッドで切り取られていると思います):
画像

助けてくれてありがとう!

乾杯

4

2 に答える 2

2

収容パネルの高さは制限されていません。何が起こっているのかというと、包含パネル(DataGridを含むStackPanel)が必要なだけ大きくなっているため、DataGridはスクロールする必要がないと考えています。

StackPanelで高さの値を設定してみてください(ウィンドウの高さなど)。スクロールバーが表示され、機能するはずです。

于 2009-07-20T16:27:45.727 に答える