如何在WPF代码中使用相对路径?

如何在WPF代码中使用相对路径?

问题描述:


在SAKryukov给了我建议以尝试在WPF中播放视频之后,我冒险对WPF进行编程.很简单,我很惊讶.
但是过去,我强迫自己使用解决方案资源管理器中的文件夹来处理内容,并使用相对路径.但我认为它在XAML中不起作用.
这是我的问题代码:

< mediae canvas.left ="0" canvas.top ="0">
名称="VideoControl" LoadedBehavior =手册"
UnloadedBehavior =停止"
来源=〜/Content/..."
Stretch ="Fill">


谁能告诉我如何使用相对路径?

谢谢,
Vince

Hi,
after SAKryukov gave me the advice to try video playing in WPF I ventured programming WPF. It is very easy, I am amazed.
But in the past I forced myself to work with folders in the solution explorer for content and work with relative paths. But I think it doesnt work in XAML.
Heres my problem code:

<mediaelement canvas.left="0" canvas.top="0">
Name="VideoControl" LoadedBehavior="Manual"
UnloadedBehavior="Stop"
Source="~/Content/..."
Stretch="Fill">


Can anyone tell me how to use a relative path?

Thanks,
Vince

通常按以下方式完成:

Typically it''s done as:

Source="/Content/SomeFolder/MyMedia.ext"