私はHeaderName(コンピュータアクセサリのカテゴリ)を持つListPickerを4つ持っています。Listpickerのフィルタリングに関するガイダンス
- プロセッサ。
- マザーボード。
- RAM。
HardDrive。
Categories.XAML.CSpublic Categories() { InitializeComponent(); this.DataContext = new manufactuers(); } private void processorListPicker_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { processorListPicker.GetBindingExpression(ListPicker.SelectedItemProperty).UpdateSource(); } private void motherboardListPicker_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { motherboardListPicker.GetBindingExpression(ListPicker.SelectedItemProperty).UpdateSource(); } private void harddriveListPicker_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { harddriveListPicker.GetBindingExpression(ListPicker.SelectedItemProperty).UpdateSource(); } private void ramListPicker_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { ramListPicker.GetBindingExpression(ListPicker.SelectedItemProperty).UpdateSource(); }
Categories.XAML
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<toolkit:ListPicker x:Name="processorListPicker" Header="Processor"
ItemsSource="{Binding List1, Mode=TwoWay}"
SelectedItem="{Binding SelectedItem1, Mode=TwoWay}"
SelectionChanged="processorListPicker_SelectionChanged" Width="360" Margin="54,106,42,0" VerticalAlignment="Top" />
<toolkit:ListPicker x:Name="motherboardListPicker" Header="Motherboard"
ItemsSource="{Binding List2, Mode=TwoWay}"
SelectedItem="{Binding SelectedItem2, Mode=TwoWay}"
SelectionChanged="motherboardListPicker_SelectionChanged" Width="360" Margin="54,191,42,0" VerticalAlignment="Top" />
<toolkit:ListPicker x:Name="harddriveListPicker" Header="HardDrive"
ItemsSource="{Binding List3, Mode=TwoWay}"
SelectedItem="{Binding SelectedItem3, Mode=TwoWay}"
SelectionChanged="harddriveListPicker_SelectionChanged" Width="360" Margin="54,282,42,240" Height="85" />
<toolkit:ListPicker x:Name="ramListPicker" Header="RAM"
ItemsSource="{Binding List4, Mode=TwoWay}"
SelectedItem="{Binding SelectedItem4, Mode=TwoWay}"
SelectionChanged="ramListPicker_SelectionChanged" Width="360" Margin="54,0,42,155" VerticalAlignment="Bottom" Height="85" />
</Grid>
manufactures.cs - ViewModelに
public class manufacturers
{
public manufacturers()
{
// MUST Initialize the selected items
SelectedItem1 = "INTEL";
SelectedItem2 = "ASUS";
SelectedItem3 = "WESTERN DIGITAL";
SelectedItem4 = "CORSAIR";
}
private IEnumerable<string> manufacturersList
{
get
{
return new[]
{
"INTEL",
"AMD",
"WESTERN DIGITAL",
"CORSAIR",
"SEAGATE",
"ASUS",
"SAMSUNG",
"TOSHIBA",
"KINGSTON",
};
}
}
public IEnumerable<string> List1
{
get
{
return manufacturersList;
}
}
public IEnumerable<string> List2
{
get
{
return manufacturersList;
}
}
public IEnumerable<string> List3
{
get
{
return manufacturersList;
}
}
public IEnumerable<string> List4
{
get
{
return manufacturersList;
}
}
public string SelectedItem1 { get; set; }
public string SelectedItem2 { get; set; }
public string SelectedItem3 { get; set; }
public string SelectedItem4 { get; set; }
}
今、ユーザーがクリックしたときどれかこれらのLISTPICKERSのうち、例えば、ユーザ選択プロセッサ - リスピッカ、プロセッサを製造するすべてのベンダは、リセチーカ項目に表示されるべきである。
注:ビューモデルまたはXMLまたはHTMLのオンライン解析から表示できる製造元のリストがあるとします。
http://www.windowsphonegeek.com/articles/listpicker-for -wp7-in-depth –
あなたの質問は何ですか? –
@Derek Beattieに返信してくれてありがとう、私はすでにこのウェブには行きましたが、私のシナリオでは何の助けも得ていません。 –