小编Zie*_*asr的帖子

使用MVVM从列表框中获取选择项

我在这个项目中使用MVVM,我有一个绑定到Customers集合的列表框.我想创建一个事件来使用elementselected的id导航detailsPage:

 <ListBox ItemsSource="{Binding Customers}" x:Name="state_list" SelectionChanged="state_list_SelectionChanged">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="selectionchanged">
                    <cmd:EventToCommand Command="{Binding stateSelectedCommand}" PassEventArgsToCommand="True"  />

                 </i:EventTrigger>
            </i:Interaction.Triggers>
                <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="{Binding nom}" />
                        <!--TextBlock Text="{Binding LastName}" />
                        <TextBlock Text="{Binding Text, ElementName=tbCount}" /-->
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何将所选项添加到uri然后使用它来获取数据.示例或教程会很有帮助.谢谢 :)

windows-phone-7 mvvm-light

2
推荐指数
1
解决办法
5486
查看次数

标签 统计

mvvm-light ×1

windows-phone-7 ×1