2
最初のlistpickerが選択を変更したときに、2番目のlistpickerのデータをフィルタし、2番目のlistpickerと同じ1番目のlistpickerで選択した項目を非表示にする必要があります。更新とフィルタlistpicker
2 listpickerのXAML ...
<my:ListPicker HorizontalAlignment="Left"
x:Name="listPicker1" Width="265" BorderBrush="{x:Null}" FontFamily="Segoe UI" FontSize="18.667" Background="{StaticResource PhoneTextBoxBrush}" ScrollViewer.VerticalScrollBarVisibility="Visible" Margin="147,0,0,0" Grid.Row="1" Foreground="#FF1BA1E2" Height="35" SelectionChanged="listPicker1_SelectionChanged" >
<my:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel Width="360" Height="34">
<TextBlock x:Name="item" Text="{Binding ChannelName, Mode=TwoWay}" FontSize="18.667" Margin="12, 0, 2, 2" />
</StackPanel>
</DataTemplate>
</my:ListPicker.ItemTemplate>
</my:ListPicker>
<TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="16" Margin="52,5,0,5" Grid.Row="3" HorizontalAlignment="Left" Width="91" Text="Channel 2 "/>
<my:ListPicker HorizontalAlignment="Left"
x:Name="listPicker2" Width="265" BorderBrush="{x:Null}" FontFamily="Segoe UI" FontSize="18.667" Background="{StaticResource PhoneTextBoxBrush}" Foreground="#FF1BA1E2" ScrollViewer.VerticalScrollBarVisibility="Visible" Margin="147,0,0,0" Grid.Row="3" SelectionChanged="listPicker2_SelectionChanged" >
<my:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel Width="360" Height="34">
<TextBlock x:Name="item" Text="{Binding ChannelName, Mode=TwoWay}" FontSize="18.667" Margin="12, 0, 2, 2" />
</StackPanel>
</DataTemplate>
</my:ListPicker.ItemTemplate>
</my:ListPicker>
XMLコードとデータバインディング
public Customize()
{
InitializeComponent();
XDocument loadedData = XDocument.Load("newsChannels.xml");
var channels = from query in loadedData.Descendants("channel")
select new Channels
{
ChannelName = (string)query.Element("channelname"),
};
listPicker1.ItemsSource = channels;
listPicker2.ItemsSource = channels;
}
public class Channels
{
string channelname;
public string ChannelName
{
get { return channelname; }
set { channelname = value; }
}
}
おかげで –
おかげでバディ..申し訳ありません..返信用のバディが、WP7のイムいないプロの開発者、uは親切にこのコードを書くために私を助けている場合、WP7アプリの開発に新しいイム...感謝それは... –
Matt、私が尋ねなければならない別の質問は、選択された項目をNone?と設定する可能性です。リストピッカーでは空になります。私はそれを検索しますが、結果の大部分は、彼らがポーティブルではないと言っていることを発見しましたが、 –