小编Nic*_*ick的帖子

WPF XAML在IsEnabled状态下更改图像不透明度

当IsEnabled为false时,我希望图像的不透明度为.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>
Run Code Online (Sandbox Code Playgroud)

wpf xaml user-controls opacity isenabled

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

标签 统计

isenabled ×1

opacity ×1

user-controls ×1

wpf ×1

xaml ×1