gpt4 book ai didi

c# - Listpicker 无法进入全屏模式 Windows Phone

转载 作者:行者123 更新时间:2023-11-30 16:12:23 25 4
gpt4 key购买 nike

我试图让列表选择器下拉菜单进入全屏模式。当我进入全屏扩展模式时,它会在第一次机会时崩溃。下面是我的代码:

C#:

monthCat.SetValue(Microsoft.Phone.Controls.ListPicker.ItemCountThresholdProperty,12);

XAML:

<toolkit:ListPicker Name="monthCat" ExpansionMode="FullScreenOnly">
<toolkit:ListPickerItem Content="January" />
<toolkit:ListPickerItem Content="February" />
<toolkit:ListPickerItem Content="March" />
<toolkit:ListPickerItem Content="April" />
<toolkit:ListPickerItem Content="May" />
<toolkit:ListPickerItem Content="June" />
<toolkit:ListPickerItem Content="July" />
<toolkit:ListPickerItem Content="August" />
<toolkit:ListPickerItem Content="September" />
<toolkit:ListPickerItem Content="October" />
<toolkit:ListPickerItem Content="November" />
<toolkit:ListPickerItem Content="December" />
</toolkit:ListPicker>

当我删除 ExpensionMode 时,它​​工作正常但不是全屏模式。

最佳答案

试试这个:

 public MainPage()
{
InitializeComponent();

SetBinding();

}

void SetBinding()
{
List<string> list = new List<string>();
list.Add("January");
list.Add("February");
list.Add("March");
list.Add("April");
list.Add("May");
list.Add("June");
list.Add("July");
list.Add("August");
list.Add("September");
list.Add("October");
list.Add("November");
list.Add("December");
monthCat.ItemsSource = list;
}

并将此代码粘贴到您的 .xaml 文件中。

 <toolkit:ListPicker Name="monthCat" ExpansionMode="FullScreenOnly" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="25"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>

关于c# - Listpicker 无法进入全屏模式 Windows Phone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23050972/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com