Vertical Bar在WPF中的DataGrid中不执行任何操作

时间:2019-07-16 09:52:24

标签: c# wpf

能告诉我为什么我的垂直滚动条什么都没做。当我设置VerticalScrollBarVisibility = True时,我实际上可以看到一个滚动条。但是它什么也没做。我是WPF设计的新手,滚动条是最难理解的之一。

<Grid>
    <StackPanel>
        <materialDesign:Card Padding="32" Margin="16">
            <TextBlock Style="{DynamicResource MaterialDesignTitleTextBlock}">UNREAD TAG REPORTER</TextBlock>
        </materialDesign:Card>

        <materialDesign:Card Margin="16 5">
            <Grid>
                <Grid.RowDefinitions>
                    <!--Row1-->
                    <RowDefinition Height="Auto" />
                    <!--Row2-->
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <!--Row1 Column1-->
                <Grid Grid.Row="0">
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Date From: " Margin="5 10 0 10"/>
                        <DatePicker Width="100" x:Name="DateFrom" />

                        <Label Content="Date To: " Margin="5 10 0 10" />
                        <DatePicker Width="100" x:Name="DateTo" />

                        <Label Content="Plaza: " Margin="25 10 0 10" />
                        <TextBox Width="50" x:Name="TxtPlaza" Text="801" Margin="5 10 0 10"/>

                        <Label Content="Lane: " Margin="10 10 0 10" />
                        <TextBox Width="50" x:Name="TxtLane" Margin="5 10 0 10" Text="4"/>

                        <Button Content="Get Values" Margin="30 0 0 0" x:Name="BtnPopulateGrid" />
                    </StackPanel>

                </Grid>
            </Grid>
        </materialDesign:Card>

        <materialDesign:Card Margin="16 5">
            <Grid>
                <Grid.RowDefinitions>
                    <!--Row1-->
                    <RowDefinition Height="Auto" />
                    <!--Row2-->
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <!--Row1 Column1-->
                <Grid Grid.Row="0">
                    <StackPanel Orientation="Horizontal">
                        <Button Content="Get Manual Count" 
                                Margin="20 10" 
                                x:Name="BtnGEtManualCount" 
                                Click="BtnGEtManualCount_OnClick"/>
                    </StackPanel>

                </Grid>
            </Grid>
        </materialDesign:Card>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <DataGrid  ColumnWidth="*" 
                       x:Name="ViewingGrid"
                       VerticalScrollBarVisibility="Auto" 
                       HorizontalScrollBarVisibility="Auto" 
                       Margin="10,0,27,0" />

        </Grid>
    </StackPanel>
</Grid>

谢谢您的帮助。

0 个答案:

没有答案