如何“命名”BitmapImage

时间:2016-11-20 15:28:33

标签: c# xaml uwp win-universal-app uwp-xaml

出于调试目的,我想设置BitmapImage的{​​{1}}属性。不幸的是它没有退出。设置断点时有没有办法识别特定的Name?在Winforms中,所有控件都具有Name属性,即使它们没有,我们也可以使用Tag属性。另一方面,对于BitmapImage,我找不到任何可比的东西。

澄清:我需要定义BitmapImage本身的内容,而不是指向它的变量,所以如果我有BitmapImage - 我可以检查{{1}这是bi2 = bi1

1 个答案:

答案 0 :(得分:0)

您可以使用x:Name定义XAML中任何对象的名称。然后,您可以将其用于调试目的。

<Image>
    <Image.Source>
        <BitmapImage x:Name="MyBitmapImage"/>
    </Image.Source>
</Image>