gpt4 book ai didi

c# - 从图像设置自适应平铺背景

转载 作者:行者123 更新时间:2023-11-30 17:40:18 24 4
gpt4 key购买 nike

我正在创建一个 TileNotification 以在我的应用程序的磁贴上显示上次编辑的项目。执行此操作时,我想将图 block 的背景设置为项目封面图像。我正在像这样创建 TileContent:

TileContent content = new TileContent()
{
Visual = new TileVisual()
{
TileMedium = new TileBinding()
{
Content = new TileBindingContentAdaptive()
{
BackgroundImage = new TileBackgroundImage()
{
Source = new TileImageSource("ms-appx:///Assets/Images/MainPageBackground.jpg"),
Overlay = 10
},

Children =
{
new TileText()
{
Text = DataModel.Instance.CurrentProject.Title,
Align = TileTextAlign.Left
}
}
}
}
}
};

问题是设置 Source 属性的唯一方法似乎是使用 TileImageSource,它只接受一个字符串。由于项目的封面图像存储在 ApplicationData.Current.LocalFolder... 中,我不能只给它一个字符串。有什么方法可以从实际图像而不是字符串设置图像源?

最佳答案

经过更多的搜索,我找到了这种方法。

您可以使用“ms-appdata:///Local”前缀来获取文件。就我而言:

$"ms-appdata:///local/Projects/{ProjectName}/Slides/0.gif".

然后可以将其作为源上交。

关于c# - 从图像设置自适应平铺背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34457002/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com