如何仅从其中一个窗口中删除滚动条? [英] How can I remove the scrollbar from just one of the windows?

查看:71
本文介绍了如何仅从其中一个窗口中删除滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mainwindow类基本上是从(C1)下面的类扩展的,对吗?
这就是继承原则.

The mainwindow class is basically extending from the class below (C1), right?
This is the inheritance principle.

namespace Microsoft.Samples.Kinect.ControlsBasics
{
    public class C1 : MainWindow
    {
        public C1() : base()
        {
            
            
        }
    }

我的问题是,您可以删除mainwindow类中的元素并将其仅应用于C1类吗?
换句话说,我有一个滚动条显示在2个地方,我想从其中一个窗口中删除它.

My question is, can you erase an element from the mainwindow class and apply this only to class C1?
In other words, I have a scrollbar that shows up in 2 places and I want to delete it from one of the windows.

实际上,我只想在其中一个窗口中使它可见,而在另一个窗口中它是永久的. 我不知道该怎么办,这就是为什么我依靠您的帮助.

Actually, i want to make it visibile in one of the windows only when it's needed, while it's permanent in the other window. 
I have no idea how I could do this, which is why I'm relying on your help.

我还为滚动添加了代码,也许可以帮助您更好地理解.

I've also added the code for the scroll, maybe it can help you understand better.

<k:KinectScrollViewer Grid.Row="0" Name="scrollViewer" HorizontalScrollBarVisibility="Visible"  VerticalScrollBarVisibility="Disabled" ScrollChanged="scrollViewer_ScrollChanged">

推荐答案

您好,您应该能够从类C1访问scrollViewer,所以请尝试以下操作:

Hi, you should be able to access to scrollViewer from class C1, so please try this:

   public class C1 : MainWindow
    {
        public C1() : base()
        {
            scrollViewer.HorizontalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Hidden;
            scrollViewer.VerticalScrollBarVisibility = System.Windows.Controls.ScrollBarVisibility.Hidden;            
        }
    }


这篇关于如何仅从其中一个窗口中删除滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆