简体   繁体   English

WPF中如何在不使用双滚动条的情况下进行响应式设计

[英]How to make responsive designing in WPF without using double scroll bar


I have facing issue regarding responsive design using WPF. but I had not find any specific solution yet.I had taken one window WPF page named MainWindow.xaml and inner taken MdiContainer child page container.我在使用 WPF 进行响应式设计时遇到了问题。但我还没有找到任何具体的解决方案。我采用了一个 window WPF 页面,名为MainWindow.xaml ,内部采用了 MdiContainer 子页面容器。 like below:如下所示:

<ScrollViewer Name="scrollViewer" VerticalScrollBarVisibility="Auto">
    <mdi:MdiContainer Name="Container" Theme="Generic">
        <mdi:MdiChild Name="ChildWindowContent" WindowState="Maximized" />
    </mdi:MdiContainer>
</ScrollViewer>

And after I had binding usercontrol in MdiContainer dynamicaaly named _CaptureLogsUserControl.xaml like below:在我在名为_CaptureLogsUserControl.xaml的 MdiContainer dynamicaaly 中绑定用户控件后,如下所示:

<ScrollViewer Name="scrollViewer" VerticalScrollBarVisibility="Auto">
    <DockPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" Style="{StaticResource PanelSaveStyle}" Width="1037" Margin="0,0,15,0" >
                <StackPanel Style="{StaticResource StackPanelRight}" Grid.Column="1" Grid.Row="17" Margin="10,0,0,0" >
                    <Label x:Name="LabelXMLPath" Width="150" Style="{StaticResource MyLabelStyle}" Content="{Binding .[UIResources.LABEL_SELECT_XMLFILE], FallbackValue={x:Static p:UIResources.LABEL_SELECT_XMLFILE}, Mode=OneWay, Source={StaticResource localisation}}" RenderTransformOrigin="0.795,0.579" Margin="0,6"/>
                    <TextBlock Style="{StaticResource ColonStyle}" Text=":" />
                    <local:_ToolTipUserControl ToolTip="{Binding Source={StaticResource localisation }, Mode=OneWay, Path=.[UIResources.TOOLTIP_SELECT_CONFIG_FILE]}" />
                </StackPanel>
            </StackPanel>
        </Grid>
    </DockPanel>
</ScrollViewer>

When I run this WPF application at that time I had got double scrollbar.当我当时运行这个 WPF 应用程序时,我得到了双滚动条。 but my scenario I have not need inner scollbar.但我的场景不需要内部 scollbar。 I had make lots of RND to remove Inner scollbar with responsive design but I had not find any specific solution yet.我做了很多 RND 来删除具有响应式设计的内部 scollbar,但我还没有找到任何具体的解决方案。 if any have solution regarding it then please help me.如果有解决方案,请帮助我。 Thanks in advance提前致谢

Apply below 2 changes:应用以下 2 项更改:

  1. Instead of MdiContainer use ContentControl in MainWindow在 MainWindow 中使用 ContentControl 而不是 MdiContainer
  2. Remove ScrollViewer control from CaptureLogsUserControl - Due to this you are getting double scrollbar从 CaptureLogsUserControl 中删除 ScrollViewer 控件 - 因此您将获得双滚动条

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM