[uwp] [c#] [xaml]如何绑定包含列表< string>的对象到listview datatemplate? [英] [uwp][c#][xaml]how to bind an object containing list<string> to listview datatemplate ?
问题描述
我正在尝试绑定绑定包含List< string>的对象listview as observablecollection,但我得到的是下面的一些东西,我正在使用x:bind当前
但我试图实现类似下面的内容
嗨!
鉴于itemssource,它只是一个列表< string>您不需要使用x:bind。
以下是代码示例:
< ; ListView ItemsSource =" {Binding TheNameOfObservableCollection}"
>
< ListView.ItemTemplate>
< DataTemplate>
< TextBlock Text =" {Binding}"
Margin =" 20,0,0,0"
/>
< / DataTemplate>
< /ListView.ItemTemplate>
< / ListView>
希望它有用。
< p style ="border:none; font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif; outline:0px; padding-right:0px; color:#333333; font-size :14px">
如果是对你有好处,你能否将这个答案标记为你的问题的答案?
在twitter上关注我: https://twitter.com/NordineMhoumadi
i am trying to bind bind an object containing List<string> to listview as observablecollection but all i was getting is some thing like below, i am using x:bind currently
but i was trying to achieve something like below
Hi!
Given that the itemssource it's just a list<string> you don't need to use x:bind.
Here is the sample of code :
<ListView ItemsSource="{Binding TheNameOfObservableCollection}" > <ListView.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}" Margin="20,0,0,0" /> </DataTemplate> </ListView.ItemTemplate> </ListView>Hope it wil be useful.
If it's good for you, can you mark this answer as answer of your question please?
Follow me on twitter : https://twitter.com/NordineMhoumadi
这篇关于[uwp] [c#] [xaml]如何绑定包含列表< string>的对象到listview datatemplate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!