gpt4 book ai didi

c# - 在 xaml 中设置样式或格式化 json 数据

转载 作者:太空宇宙 更新时间:2023-11-03 15:53:08 26 4
gpt4 key购买 nike

我正在开发 Windows Phone 8.1 应用程序,但由于我是初学者,而且我的背景更倾向于我编写 css 和魔术作品的网站。我发现很难格式化绑定(bind)到我的 xaml 的 JSON 数据。

我的 JSON 代码

{"Groups":[
{
"UniqueId": "BasicxGroup1",
"Title": "Startup",
"Subtitle": "test subtitle 1",
"ImagePath": "Assets/startup1.jpg"
"Items":
[
{
"UniqueId": "Group-1-Item-1",
"Title": "Item Title: 1",
"Subtitle": "Item Subtitle: 1",
"ImagePath": "Assets/LightGray.png",
"Description" : "test description",
"Content" : "test content some formatting needed"
}
]
}
]
}

我可以使用其他选项,比如我可以将另一个键添加到我的组项目,然后将它绑定(bind)到我的 xaml,然后我可以单独设置它的样式,但仅仅为了格式化,这是必要的吗?我还有其他选择吗?

我的 XAML 代码

<Grid Grid.Row="0">
<TextBlock Margin="10,0,10,0" FontSize="18" Text="{Binding Description}" />
</Grid>

<Grid Grid.Row="1">
<TextBlock Margin="10,0,10,0" FontSize="18" Text="{Binding Content}" /></Grid>
</Grid>

我是新手,我正在学习,所以如果我有任何错误,请指出我。

最佳答案

考虑使用 RichTextBox控制。

关于c# - 在 xaml 中设置样式或格式化 json 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24946291/

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