Windows phone 7 单击添加Listpicker

Windows phone 7 单击添加Listpicker,windows-phone-7,windows-phone-7.1,Windows Phone 7,Windows Phone 7.1,我想点击一个按钮一个接一个地添加listpicker,同时listpicker的控件应该在listpicker的每个添加上向下移动单词。请给我一个建议 用于创建listpicker的XAML代码 <toolkit:ListPicker Grid.Row="0" Margin="5,76,226,-52" x:Name="list" ItemTemplate="{StaticResource PickerItemTemplate}" ItemCountThreshold="3"

我想点击一个按钮一个接一个地添加listpicker,同时listpicker的控件应该在listpicker的每个添加上向下移动单词。请给我一个建议

用于创建listpicker的XAML代码

   <toolkit:ListPicker Grid.Row="0"  Margin="5,76,226,-52" x:Name="list" ItemTemplate="{StaticResource PickerItemTemplate}" ItemCountThreshold="3"
                            FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}"   FullModeHeader="Select your Monthly Debts:" SelectedIndex="2"  CacheMode="BitmapCache"
                            FontFamily="Arial Black" FontSize="32" FontWeight="ExtraBlack"/>

您可以创建ListPicker并使用到ObservableCollection的绑定

ObsarvableCollection的优点是,您的更改会在视图上自动更新。 有关更多信息,请参阅。
还可以看看

您可以像任何其他控件一样,将ListPicker动态添加到UI中

对于向下移动其他控件的其他要求,我建议您对上面显示的ListPicker XAML代码做一点小修改

<StackPanel x:Name="StackPanelListPickers" Grid.Row="0">
<toolkit:ListPicker  Margin="5,76,226,-52" x:Name="list" ItemTemplate="{StaticResource PickerItemTemplate}" ItemCountThreshold="3"
                        FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}"   FullModeHeader="Select your Monthly Debts:" SelectedIndex="2"  CacheMode="BitmapCache"
                        FontFamily="Arial Black" FontSize="32" FontWeight="ExtraBlack"/>
</StackPanel>

您想要动态添加ListPicker的代码吗?或者在添加时向下移动其他元素的想法?检查上面的更新,问题是我是否可以在每次单击时创建此listpicker的实例(最多8个)。以及在添加时向下移动其他元素的想法。
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace NewUIChanges
{
public class payment
{
    public string Name
    {
        get;
        set;
    }
}
}
<StackPanel x:Name="StackPanelListPickers" Grid.Row="0">
<toolkit:ListPicker  Margin="5,76,226,-52" x:Name="list" ItemTemplate="{StaticResource PickerItemTemplate}" ItemCountThreshold="3"
                        FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}"   FullModeHeader="Select your Monthly Debts:" SelectedIndex="2"  CacheMode="BitmapCache"
                        FontFamily="Arial Black" FontSize="32" FontWeight="ExtraBlack"/>
</StackPanel>
//Generate a dynamic listpicker
ListPicker lp = new ListPicker() { Name = "List2" };
lp.Template = this.Resources["PickerItemTemplate"] as ControlTemplate;
lp.FullModeItemTemplate = this.Resources["FullModeItemTemplate"] as DataTemplate;
//And all other properties of "lp" as you need ..I am not writing all here

//Now add this new Listpicker to the stackpanel which is the child of the Grid
this.StackPanelListPickers.Children.Add(lp);