[UWP] [VB.NET] TileBindingContentAdaptive - 属性'children'是只读的 [英] [UWP][VB.NET] TileBindingContentAdaptive - property 'children' is read only
问题描述
我正在使用UWP社区工具包并试图将LiveTile代码合并到我的项目中,但我得到'属性'孩子'只读'
I'm using the UWP Community Toolkit and trying to incorporate the LiveTile code into my project, but I get 'property 'children' is read only'
Private Function GenerateTileBindingMedium(username As String, avatarLogoSource As String) As TileBinding
Return New TileBinding() With {
.Content = New TileBindingContentAdaptive() With {
.PeekImage = New TilePeekImage() With {
.Source = avatarLogoSource,
.HintCrop = TilePeekImageCrop.Circle
},
.TextStacking = TileTextStacking.Center,
.Children = {New AdaptiveText() With {
.Text = "Hi,",
.HintAlign = AdaptiveTextAlign.Center,
.HintStyle = AdaptiveTextStyle.Base
}, New AdaptiveText() With {
.Text = username,
.HintAlign = AdaptiveTextAlign.Center,
.HintStyle = AdaptiveTextStyle.CaptionSubtle
}}
}
}
End Function
我该如何解决这个问题?
How can I fix this ?
我也很难理解LiveTile代码与Visual Asset Generator扩展的关系。
I'm also struggling to understand how the LiveTile code relates to the Visual Asset Generator extension.
基本上我需要所有可通过商店认证的视觉资产,但我需要一种机制,允许用户选择要在图块上显示的图像来源。
Basically I need all the Visual Assets to pass Store Certification, but I need a mechanism that will allow the user to choose the source of an image to display on the tile.
任何帮助都会非常感谢
Any help would be great thanks
推荐答案
你好theresonlyonefinmaf,
Hi theresonlyonefinmaf,
感谢您的代码片段。
>>如何修复属性'children'是只读的?
>> How can I fix property 'children' is read only?
您使用UWP Community Toolkit创建了一个磁贴,并尝试完成它。但有些错误表明孩子们只读。
You created a tile using UWP Community Toolkit and tried to complete it. But there are errors that said the children is read only.
我做了一个样本来测试它,我也重现了这个问题。要解决此问题,您可以选择使用"Children.Add()"方法。
I made a sample to test it and I reproduced the issue too. To solve the issue, you could choose to use "Children.Add()" method.
请参考以下代码示例以供参考:
Please refer to the following code sample for reference:
Dim content As New TileContent()
Dim Visual As New TileVisual()
Dim tileMedium As New TileBinding()
Dim adaptive As New TileBindingContentAdaptive()
Dim peekImage As New TilePeekImage()
adaptive.PeekImage = peekImage
adaptive.PeekImage.Source = "Assets/testCat.jpg"
adaptive.PeekImage.HintCrop = TilePeekImageCrop.Circle
adaptive.TextStacking = TileTextStacking.Center
Dim Mytext As New AdaptiveText()
Mytext.Text = "hi"
Mytext.HintAlign = AdaptiveTextAlign.Center
Mytext.HintStyle = AdaptiveTextStyle.Base
adaptive.Children.Add(Mytext)
tileMedium.Content = adaptive
Visual.TileMedium = tileMedium
content.Visual = Visual
Dim tileNotification = New TileNotification(content.GetXml())
tileNotification.Tag = "1"
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification)
最好的问候,
Xavier Eoro
Xavier Eoro
这篇关于[UWP] [VB.NET] TileBindingContentAdaptive - 属性'children'是只读的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!