Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 检测滚动条属于哪个元素_Wpf_Grid_Devexpress_Gridcontrol - Fatal编程技术网

Wpf 检测滚动条属于哪个元素

Wpf 检测滚动条属于哪个元素,wpf,grid,devexpress,gridcontrol,Wpf,Grid,Devexpress,Gridcontrol,我有一个相对复杂的布局。它包括: 一列三行的网格。 在第一行(给我带来麻烦的那一行),我有一个developer express componenet—另一个GridControl 我的问题是,尽管第一行的高度是自动的,但垂直滚动条仍会显示,即使有足够的空间容纳内容 我已尝试在行的行定义上设置ScrollViewer.VerticalScrollBarVisibility=“Hidden”,但这没有帮助 同样,我已经将内部GridControl设置为不使用滚动条(使用一些Developer Ex

我有一个相对复杂的布局。它包括: 一列三行的网格。 在第一行(给我带来麻烦的那一行),我有一个developer express componenet—另一个GridControl

我的问题是,尽管第一行的高度是自动的,但垂直滚动条仍会显示,即使有足够的空间容纳内容

我已尝试在行的行定义上设置ScrollViewer.VerticalScrollBarVisibility=“Hidden”,但这没有帮助

同样,我已经将内部GridControl设置为不使用滚动条(使用一些Developer Express magic,而不仅仅是ScrollViewer,因为这不起作用)

然而,不管我做什么,那该死的滚动条出现了。。。有没有办法找出哪个控件渲染它,这样我就可以禁用这个该死的东西?这不仅仅是一个丑陋的问题-滚动它实际上破坏了布局

提前谢谢

有关守则:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" />
        <RowDefinition Height="*" MaxHeight="240" />
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <dxg:GridControl Name="StudySizeGrid" Grid.Column="0" Grid.Row="0" >
        <dxg:GridControl.Resources>
            <ControlTemplate x:Key="{dxgt:TableViewThemeKey ResourceKey=ControlTemplate}">
                <ScrollViewer x:Name="scr" 
          VerticalScrollBarVisibility="Disabled" 
          HorizontalScrollBarVisibility="Disabled"
          Focusable="False"
          dxg:GridControl.CurrentView="{Binding RelativeSource={RelativeSource TemplatedParent}}"
          Template="{DynamicResource {dxgt:TableViewThemeKey ResourceKey=ScrollViewerTemplate}}">
                    <ScrollViewer.CanContentScroll>False</ScrollViewer.CanContentScroll>
                </ScrollViewer>
            </ControlTemplate>
        </dxg:GridControl.Resources>
...
</dxg:GridControl>

假的
...

编辑澄清:这是WPF问题:-)

您可以使用类似谷歌Chrome的工具

我会在Chrome中,右键单击有滚动条的区域并选择“Inspect Element”。Chrome将用边框突出显示您正在查看的元素。然后,您可以在Google Chrome的inspector中导航html,直到它使用滚动条高亮显示该元素


然后你可以从那里找到原因。

你可以使用类似谷歌Chrome的工具

我会在Chrome中,右键单击有滚动条的区域并选择“Inspect Element”。Chrome将用边框突出显示您正在查看的元素。然后,您可以在Google Chrome的inspector中导航html,直到它使用滚动条高亮显示该元素


您可以从那里找到原因。

您可以尝试查看VisualTree,我认为这可能会有所帮助,它可能还有其他一些有用的功能。获取VisualTree是一件小事,但是,您可以使用
VisualTreeHelper
编写一个递归方法,因此您可能不需要大炮

e、 g

publicstatictreevieItemgetVisualTree(此DependencyObject dpo)
{
TreeView项目=新建TreeView项目();
item.Header=dpo.GetType().ToString().Split('.').Last();
if(dpo是FrameworkElement&(dpo作为FrameworkElement).Name!=string.Empty)item.Header+=“(“+(dpo作为FrameworkElement.Name+”)”;
int cCount=VisualTreeHelper.GetChildrenCount(dpo);
对于(int i=0;i

很久以前写过,它非常粗略(不建议将其作为扩展方法),一次获取整个树,可以修改为仅在节点扩展时获取子节点。

您可以尝试查看VisualTree,我认为这可能会有所帮助,它可能还有一些其他有用的功能。获取VisualTree是一件小事,但是,您可以使用
VisualTreeHelper
编写一个递归方法,因此您可能不需要大炮

e、 g

publicstatictreevieItemgetVisualTree(此DependencyObject dpo)
{
TreeView项目=新建TreeView项目();
item.Header=dpo.GetType().ToString().Split('.').Last();
if(dpo是FrameworkElement&(dpo作为FrameworkElement).Name!=string.Empty)item.Header+=“(“+(dpo作为FrameworkElement.Name+”)”;
int cCount=VisualTreeHelper.GetChildrenCount(dpo);
对于(int i=0;i

很久以前写过,它非常粗略(不建议将其作为扩展方法),一次获取整个树,可以修改为仅在节点扩展时获取子节点。

您可以发布滚动条的SS吗?很抱歉,因为我的老板非常偏执,我们正在为第三方开发此功能,我不允许上传截图:/这很愚蠢,但我不能真的违背上级的话…你能在滚动条上贴个SS吗?对不起,因为我的老板真的很偏执,我们正在为第三方开发这个,我不允许上传截图:/这很愚蠢,但我不能违背上级的话…谢谢你,伙计!我会尽快看看我在路上的路上,但明天我会去检查的。谢谢Snoop的提示——它看起来对我有帮助。谢谢你,伙计!我会尽快看看我在路上的路上,但明天我会去检查的。谢谢Snoop的提示——它看起来对我有帮助。
public static TreeViewItem GetVisualTree(this DependencyObject dpo)
{
    TreeViewItem item = new TreeViewItem();
    item.Header = dpo.GetType().ToString().Split('.').Last();
    if (dpo is FrameworkElement && (dpo as FrameworkElement).Name != string.Empty) item.Header += " (" + (dpo as FrameworkElement).Name + ")";
    int cCount = VisualTreeHelper.GetChildrenCount(dpo);
    for (int i = 0; i < cCount; i++)
    {
        item.Items.Add(VisualTreeHelper.GetChild(dpo, i).GetVisualTree());
    }
    return item;
}