【问题标题】:c# wpf - wrong dir for images but video works okc# wpf - 错误的图像目录但视频工作正常
【发布时间】:2016-10-12 15:12:30
【问题描述】:

我在 Visual Studio 2k15 中创建了 WPF C# 项目,并在 X 目录中放置了 2 个文件,所以我的目录如下所示:

app.exe
X->1.mp4,2.png

当我为 mediaelement(视频)选择目录时,它工作正常

<MediaElement x:Name="backgroundvideo" Source="X\1.mp4" IsMuted="True"/>

但是当我为我的图像元素(图像)选择目录时,它会说:

Could not find file (path to vs main folder)

我的图像元素看起来像这样:

<Image x:Name="login_ico_png" Source="x/2.png" Margin="120,50,120,422"  
                            Stretch="Fill" Width="128" Height="128"/>

【问题讨论】:

    标签: c# wpf image path


    【解决方案1】:

    试试:

    <Image x:Name="login_ico_png" Source="ms-appx:///x/2.png" Margin="120,50,120,422"  
                                Stretch="Fill" Width="128" Height="128"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-15
      • 1970-01-01
      相关资源
      最近更新 更多