c# - 如何从另一个项目绑定(bind) UWP 项目图像?

标签 c# .net uwp

我有image control在 UWP 页面中。我写了位于其他项目中的源路径,但图像不显示,也不显示设计器或运行时。如何解决这个问题?

<Page
x:Class="Platform.Universal.LoadingWindow.LoadingWindow"
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"
Background="Transparent">
<Grid>
    <Image x:Name="LoadingImage"
        Stretch="Fill" 
           Source="ms-appdata:///Resources.Universal/Resources/ChangableFiles/Default/LoadingImage.png" />
</Grid>

最佳答案

你不能。如果您在 list 中设置了 broadFileSystemAccess ,那么您唯一可能这样做的方法是,然后从后面的代码中的文件系统路径加载图像并分配它(或从 View 模型中类似的东西) .

但请注意,在 Microsoft Store 上几乎可以肯定,如果这是请求它的原因,您的应用将被拒绝使用 broadFileSystemAccess

关于c# - 如何从另一个项目绑定(bind) UWP 项目图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54883673/

相关文章:

c# - 将两个 LINQ 语句合并为一个

java - 解析来自 .Net 网络服务的 JSON 响应

c# - C# 的浮点比较函数

win-universal-app - UWP(通用Windows平台)的学习资源

windows - UWP WebView 中的自定义用户代理

c# - 我可以保存回发状态并恢复吗?

c# - 使用 azure 函数从 azure 存储表中检索数据

c# - 在 SQL Server 数据库 C# 中保存表情

.net - Automapper 向 Map 方法添加日志记录

navigation - 如何在 UWP 托管应用程序 (JS) 中完全禁用后退按钮