简体   繁体   English

Longlistselector动态更新未绑定的项目

[英]Longlistselector dynamically update not binded items

I have a longlistselector which is binded to my class. 我有一个longlistselector绑定到我的班上。 In item template I've got textblock, that is not binded to any field in class. 在项目模板中,我有textblock,它没有绑定到类中的任何字段。
Is there any way to iterate on list and fill that textblock with data? 有什么方法可以在列表上迭代并用数据填充该文本块?
Something like this: 像这样:

foreach (var item in myList)
        {
            item.textblock = SomeMethod(item.field);
        }
            <phone:LongListSelector x:Name="Name" ItemsSource="{Binding MyCollection}" Margin="0,0,-12,0">
            <phone:LongListSelector.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="0,0,0,17">
                        <TextBlock Text="{Binding PropertyTitle}" TextWrapping="NoWrap"
                                   Style="{StaticResource PhoneTextExtraLargeStyle}" />
                    </StackPanel>
                </DataTemplate>
            </phone:LongListSelector.ItemTemplate>
        </phone:LongListSelector>

Where PropertyTitle is the name of your property 其中PropertyTitle是您的财产的名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM