WPF在运行模式下忽略d:IsHidden ="True"(在设计模式下正常)

Sph*_*inx 1 c# wpf hidden expression-blend

为什么左图像隐藏在设计模式中而不是隐藏在运行时?看起来WPF忽略属性"IsHidden".新的空解决方案,没有单行代码 - 只是Blend.

左边是设计模式 - 右边是运行模式

这是我的代码

<Window
    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="WpfApplication222.MainWindow"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <Image HorizontalAlignment="Left" Height="157.093" Margin="98.316,88.148,0,0" VerticalAlignment="Top" Width="95" Source="pack://siteoforigin:,,,/img0.jpg" RenderTransformOrigin="0.5,0.5" d:IsHidden="True">
        <Image.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform Angle="-37.445"/>
                <TranslateTransform/>
            </TransformGroup>
        </Image.RenderTransform>
    </Image>
    <Image HorizontalAlignment="Left" Height="122" Margin="350,92,0,0" VerticalAlignment="Top" Width="106" RenderTransformOrigin="0.5,0.5" Source="pack://siteoforigin:,,,/img14.jpg">
        <Image.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform Angle="13.144"/>
                <TranslateTransform/>
            </TransformGroup>
        </Image.RenderTransform>
    </Image>
</Grid>
Run Code Online (Sandbox Code Playgroud)

Mik*_*son 5

在XAML的顶部,您将看到以下内容:

mc:Ignorable="d" 
Run Code Online (Sandbox Code Playgroud)

这基本上是说"在运行时忽略任何带有d:前缀的东西".

您可以删除此行(不推荐),也可以使用该Visibility属性.哪个不会被忽视.