【问题标题】:Image Source from C# XAML来自 C# XAML 的图像源
【发布时间】:2015-03-25 08:03:57
【问题描述】:

我需要从 C# 设置图像源。我尝试了X:Name="headimg",但在 C# 中找不到 headimg。

<StackPanel x:Name="Body">
<Image x:Name="headimg" Source="img/logo.png" Height="120" Width="130" HorizontalAlignment="Left"></Image>
</StackPanel>

【问题讨论】:

    标签: xaml windows-phone


    【解决方案1】:

    试试这个:

    public void SetImage()
    {
        BitmapImage imge = new BitmapImage(new Uri("/Assets/Images/ImageName.png", UriKind.Relative));
        headimg.Source=image.Source;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-18
      • 2017-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多