-1
<Window x:Class="ResizeMove0923.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Window.Resources>
<Style TargetType="Control" >
<Setter Property="Cursor" Value="SizeAll" />
</Style>
</Window.Resources>
<Canvas Background="Beige" Name="canvas" >
<Label Canvas.Left="72" Canvas.Top="23" Height="23" Name="textbox1" Width="75" Content="ttttt" />
<TextBox Height="21" Canvas.Left="147" Canvas.Top="23" Width="75" Name="textbox2" Text="&Well" />
<TextBox Canvas.Left="147" Canvas.Top="60" Height="24" Name="textBox3" Width="128" />
</Canvas>
正如我无法设置为我的画布的所有元素,使用样式游标类型是一个新手。如果我将TargetType作为Label或TextBox,它就可以工作。但我希望光标可以更改为将添加到画布的所有类型的元素。我的Style元素有什么问题?
无论鼠标在画布中的哪个位置,都会使光标SizeAll。我想要的是,只有鼠标悬停在画布内的其中一个元素上时,光标才会变为SizeAll。例如,在上面的XAML中有3个元素。我只想当鼠标移动到这三个元素中的一个时,并且在画布中的其他位置,它应该切换回正常的指针光标 – user2192101
@ user2192101问题是你已经写了,你想要改变所有元素的光标,与MouseOver或其他内容无关 – Spawn