英文:
Cursor Not Changing on GridSplitter - Community Toolkit
问题
尝试使用Community Toolkit GridSplitter,但当我悬停在分隔栏上时,光标不会更改。更改GripperCursor或CursorBehavior属性没有效果。它仍然保持默认的光标。
当单击并拖动时,它会调整窗格的大小,但鼠标光标的行为不如预期。
我正在使用以下包:
- WindowsAppSDK 1.3.2305,
- CommunityToolkit.WinUI.UI 7.1.2,
- CommunityToolkit.WinUI.UI.Controls.Layout 7.1.2
<Page
x:Class="AppPrototypes.Views.GridSplitter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppPrototypes.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
mc:Ignorable="d"
>
<Grid >
<Grid.RowDefinitions>
<RowDefinition MinHeight="100" />
<RowDefinition Height="Auto"/>
<RowDefinition MinHeight="100"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock Margin=" 10 10 0 0" Text="顶部行。
这段文字用于模拟网格的调整大小功能" />
</Grid>
<controls:GridSplitter Grid.Row="1"
GripperCursor="UniversalNo"
CursorBehavior="ChangeOnGripperHover" />
<Grid Grid.Row="2">
<TextBlock Text="底部行。
这段文字用于模拟网格的调整大小功能" />
</Grid>
</Grid>
</Page>
英文:
Trying out the Community Toolkit GridSplitter, but the cursor does not change when I hover over the splitter bar. Changing the GripperCursor or CursorBehavior properties has no effect. It stays with the default cursor.
It resizes the panes when clicked and dragged, but the mouse cursor does not behave as expected.
I am using packages
WindowsAppSDK 1.3.2305,
CommunityToolkit.WinUI.UI 7.1.2 and
CommunityToolkit.WinUI.UI.Controls.Layout 7.1.2
<Page
x:Class="AppPrototypes.Views.GridSplitter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppPrototypes.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
mc:Ignorable="d"
>
<Grid >
<Grid.RowDefinitions>
<RowDefinition MinHeight="100" />
<RowDefinition Height="Auto"/>
<RowDefinition MinHeight="100"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock Margin=" 10 10 0 0" Text="Top Row.
This text to simulate the resizing feature of the Grid" />
</Grid>
<controls:GridSplitter Grid.Row="1"
GripperCursor="UniversalNo"
CursorBehavior="ChangeOnGripperHover" />
<Grid Grid.Row="2">
<TextBlock Text="Bottom Row.
This text to simulate the resizing feature of the Grid" />
</Grid>
</Grid>
</Page>
答案1
得分: 1
I'm not sure but I guess the cursor of the GridSplitter
doesn't work on WinUI 3 apps.
You should try the GridSplitter
from the CommunityToolkit.Labs.WinUI.SizerBase NuGet package. I can confirm that its cursor works.
-
Add a new NuGet package source.
-
Temporarily, disable other package sources, including nuget.org.
I don't know why but I couldn't install the CommunityToolkit.Labs.WinUI.SizerBase with other sources enabled. -
Enable Include prerelease.
-
Add the CommunityToolkit.Labs.WinUI.SizerBase package.
And use it like this:
<Page
x:Class="GridSplitterExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.Labs.WinUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:GridSplitterExample"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="100" />
<RowDefinition Height="Auto" />
<RowDefinition MinHeight="100" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock
Margin="10,10,0,0"
Text="Top Row." />
</Grid>
<controls:GridSplitter
Grid.Row="1"
Cursor="UniversalNo" />
<Grid Grid.Row="2">
<TextBlock Text="Bottom Row." />
</Grid>
</Grid>
</Page>
英文:
I'm not sure but I guess the cursor of the GridSplitter
doesn't work on WinUI 3 apps.
You should try the GridSplitter
from the CommunityToolkit.Labs.WinUI.SizerBase NuGet package. I can confirm that its cursor works.
-
Add a new NuGet package source.
-
Temporarily, disable other package sources, including nuget.org.
I don't know why but I couldn't install the CommunityToolkit.Labs.WinUI.SizerBase with other sources enabled. -
Enable Include prerelease.
-
Add the CommunityToolkit.Labs.WinUI.SizerBase package.
And use it like this:
<Page
x:Class="GridSplitterExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.Labs.WinUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:GridSplitterExample"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="100" />
<RowDefinition Height="Auto" />
<RowDefinition MinHeight="100" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock
Margin="10,10,0,0"
Text="Top Row." />
</Grid>
<controls:GridSplitter
Grid.Row="1"
Cursor="UniversalNo" />
<Grid Grid.Row="2">
<TextBlock Text="Bottom Row." />
</Grid>
</Grid>
</Page>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论