0

我已经通过 WCF 创建了应用程序并连接了数据库,在主页中加载了产品名称(数据库的第一列)。

我怎么能意识到:

当我点击“橙色”时,ItemInfoPage 被打开,第 2、3 列的信息被加载到页面

例子

D B:

Name     Color     Number
Orange   Orange    25
Apricot  Yellow    14
Apple    Red       18

MainPage.xaml:

Things:
Orange click--> ItemInfo.xaml opens --> Color: Orange, Number: 25 is loaded on page
Apricot click--> ItemInfo.xaml opens --> Color: Yellow, Number: 14 is loaded on page
Apple click--> ItemInfo.xaml opens --> Color: Red, Number: 18 is loaded on page

MainPage.xaml 中的代码:

<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="StudentDataTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Margin="10" Text="{Binding Name}" />
        </StackPanel>
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <ListBox ItemsSource="{Binding}" 
             ItemTemplate="{StaticResource StudentDataTemplate}"
             Height="Auto"
             Width="460"
             Margin="10,10,0,0" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top"
             Name="ListBox1"/>
        <Button Click="navigateitem" 
Content="Button" 
Height="72"
HorizontalAlignment="Left" 
Margin="142,351,0,0" 
Name="button1" 
VerticalAlignment="Top" 
Width="160" />
    </Grid>

如何加载必要项目的颜色和数字列?

如何从表的必要行加载数据?

4

1 回答 1

0

只需看看这里并从一个简单的复制/粘贴示例开始了解

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202876(v=vs.105).aspx

于 2013-02-25T07:57:04.127 回答