当IsEnabled为false时,我希望图像的不透明度为0.50。我已经查看了多个示例,但仍然无法掌握如何使其工作。
这是我的自定义控件的完整XAML。非常感谢您的帮助。
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="test.StopButtonControl"
x:Name="UserControl"
d:DesignWidth="85" d:DesignHeight="85">
<Grid x:Name="LayoutRoot">
<Image x:Name="StopButtonUI" Source="Images/stop.png" Stretch="Fill" MouseUp="StopButtonClick"/>
</Grid>
</UserControl>
Opacity
的范围所困扰。对于那些最初认为范围是从0
到100
的人,一定要再次确认你实际上使用的是从0
到1
的范围,就像这里演示的一样,否则看起来好像什么也没有改变。 - Reece