Windows Phone 7 listpicker itemsource模板问题

发布于 2024-12-11 14:57:35 字数 1494 浏览 0 评论 0原文

我试图让列表选择器显示 iList 中的属性。当我运行应用程序时,出现的是绑定信息..不是那个属性..

这是xaml

 <phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Name="lpkItemTemplate">
        <TextBlock Text="{Binding Operation}" />
    </DataTemplate>
    <DataTemplate x:Name="lpkFullItemTemplate">
        <TextBlock Text="{Binding Operation}" />
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>
 <toolkit:ListPicker x:Name="lbOperation" Header="Operations"  SelectedIndex="0" 
                        FullModeItemTemplate="{Binding lpkFullItemTemplate}"
             ItemTemplate="{Binding lpkItemTemplate}"
                        Grid.Row="5" 
                        >

和背后的代码,

        Dim Os As List(Of wsOperation.Operation) = e.Result
    Me.lbOperation.ItemsSource = Os

我认为这是一个模板错误,因为列表中的行数是当我单击列表选择器时出现。但我询问的属性(“操作”)不显示数据。相反,我显示了大约 10 行 wsOperation.Operation。

谢谢 香农

~~~~~~~~~ 也许更多的信息将有助于找到可能的解决方案 时列表选择器显示的内容..这就是列表选择器显示的内容

运行此页面ProcWP.wsOperation.Operation

这是当我单击上面的行时

ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation

I'm trying to get the listpicker to show a property that is in an iList. When i run the app, what comes up instead is the binding info.. not that property..

Here is the xaml

 <phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Name="lpkItemTemplate">
        <TextBlock Text="{Binding Operation}" />
    </DataTemplate>
    <DataTemplate x:Name="lpkFullItemTemplate">
        <TextBlock Text="{Binding Operation}" />
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>
 <toolkit:ListPicker x:Name="lbOperation" Header="Operations"  SelectedIndex="0" 
                        FullModeItemTemplate="{Binding lpkFullItemTemplate}"
             ItemTemplate="{Binding lpkItemTemplate}"
                        Grid.Row="5" 
                        >

and the code behind

        Dim Os As List(Of wsOperation.Operation) = e.Result
    Me.lbOperation.ItemsSource = Os

i'm thinking it is a template error because the number of rows in the list is the number that comes up when i click on the listpicker.. but the property i've asked ("Operation") is not displaying the data. Instead i get ~10 rows of wsOperation.Operation showing up.

thanks
shannon

~~~~~~~~~
maybe a little more info will help with a possible solution
Here is what the listpicker shows when i run this page

ProcWP.wsOperation.Operation

when i click on the above line.. this is what the listpicker shows

ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation
ProcWP.wsOperation.Operation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮茶煮酒煮时光 2024-12-18 14:57:35

这个问题的答案就在工具包里:ListPicker。我需要将 {Binding lpkFullItemTemplate} 更改为 {StaticResource lpkFullItemTemplate} 并与 itemTemplate 相同

,所以现在看起来像这样

<toolkit:ListPicker x:Name="lbOperation" Header="Operations"  SelectedIndex="1" 
                        FullModeItemTemplate="{StaticResource lpkFullItemTemplate}"
             ItemTemplate="{StaticResource lpkItemTemplate}"
                        Grid.Row="5" 
                        >

the answer to this problem was in the toolkit:ListPicker. I needed to change the {Binding lpkFullItemTemplate} to {StaticResource lpkFullItemTemplate} and same with itemTemplate

so it looks like this now

<toolkit:ListPicker x:Name="lbOperation" Header="Operations"  SelectedIndex="1" 
                        FullModeItemTemplate="{StaticResource lpkFullItemTemplate}"
             ItemTemplate="{StaticResource lpkItemTemplate}"
                        Grid.Row="5" 
                        >
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文