相关疑难解决方法(0)

scrollviewer里面的Listview阻止了scrollviewer滚动

我有一个滚动查看器,里面有几个列表框.问题是如果用户使用鼠标中键滚动滚动查看器,而鼠标位于列表视图上方.列表视图将其内部滚动查看器滚动到底部,然后继续捕获鼠标,防止包含滚动查看器滚动.

关于如何处理这个问题的任何想法?

c# wpf listbox scrollviewer

19
推荐指数
4
解决办法
2万
查看次数

WPF从TreeView中删除ScrollViewer

我想知道是否可以轻松关闭TreeView的ScrollViewer.

我有一个带网格的UserControl.其中一个Cell在Stackpanel中有一些TreeView.Control的高度根据TreeView的高度自动调整,因此不需要滚动条.

问题是:我在ListBox中有一堆具有自己的ScrollViewer,但是当我使用MouseWheel时,当你在TreeView上时滚动停止.

这是因为TreeView有自己的ScrollViewer来窃取MouseWheel.我知道这可能是通过覆盖控件模板来实现的,但我希望有一种更简单的方法.

c# wpf treeview scrollviewer

15
推荐指数
1
解决办法
6009
查看次数

WPF:无法在 DataGrids 中滚动

我有一个管理锦标赛的应用程序。我有滚动问题的视图如下所示:Group Phase View Screenshot

现在我遇到了当鼠标悬停在 DataGrid 上时无法滚动的问题。例如,只要我尝试在扩展器上滚动 - 它就可以工作(但是一旦鼠标再次越过 DataGrid,滚动就会停止)。ScrollViewer 本身也按预期工作,例如当我尝试使用滚动条本身滚动时。

视图构建如下...

我有一个看起来像这样的 GroupPhaseView(这个视图包含 ScrollViewer):

<UserControl x:Class="TournamentApplication.UI.Tournament.GroupPhase.GroupPhaseView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:groupPhase="clr-namespace:TournamentApplication.UI.Tournament.GroupPhase"
         mc:Ignorable="d" 
         d:DesignHeight="450" d:DesignWidth="800">
<Grid>
    <ScrollViewer VerticalScrollBarVisibility="Auto">
        <ItemsControl ItemsSource="{Binding GroupPhaseCategoryViewModels}">
            <ItemsControl.ItemTemplate>
                <DataTemplate DataType="groupPhase:GroupPhaseCategoryViewModel">
                    <groupPhase:GroupPhaseCategoryView />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </ScrollViewer>
</Grid>
Run Code Online (Sandbox Code Playgroud)

此 GroupPhaseView 包含多个 GroupPhaseCategoryView。一个 GroupPhaseCategoryView 看起来像这样:

<UserControl x:Class="TournamentApplication.UI.Tournament.GroupPhase.GroupPhaseCategoryView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:groupPhase="clr-namespace:TournamentApplication.UI.Tournament.GroupPhase"
         mc:Ignorable="d" 
         d:DesignHeight="450" d:DesignWidth="800">
<Grid>
    <Expander Header="{Binding Category.Name}" IsExpanded="True">
        <ItemsControl ItemsSource="{Binding GroupPhaseGroupViewModels}">
            <ItemsControl.ItemTemplate>
                <DataTemplate DataType="groupPhase:GroupPhaseGroupViewModel">
                    <groupPhase:GroupPhaseGroupView />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Expander>
</Grid>
Run Code Online (Sandbox Code Playgroud)

此 GroupPhaseCategoryView 包含多个 GroupPhaseGroupView。它们包含两个导致滚动问题的 …

c# wpf datagrid scrollviewer

4
推荐指数
1
解决办法
1520
查看次数

标签 统计

c# ×3

scrollviewer ×3

wpf ×3

datagrid ×1

listbox ×1

treeview ×1