每当我试图访问我的应用程序中的m列表选择器控件时,我就会得到这个异常。
+ this {App_name.App} App_name.App
+ sender {App_name.App} object {App_name.App}
- e {System.Windows.ApplicationUnhandledExceptionEventArgs} System.Windows.ApplicationUnhandledExceptionEventArgs
+ base {System.Windows.ApplicationUnhandledExceptionEventArgs} System.EventArgs {System.Windows.ApplicationUnhandledExceptionEventArgs}
+ ExceptionObject {System.ArgumentException: Value does not fall within the expected range.} System.Exception {System.ArgumentException}
Handled false bool
+ Non-Public members
我的列表选择器的代码是
<ListBox Margin="0,417,0,0">
<ListBoxItem>
<toolkit:ListPicker Name="LearnerFileChooser" Width="431" >
<toolkit:ListPickerItem Content="A" />
<toolkit:ListPickerItem Content="B" />
<toolkit:ListPickerItem Content="C" />
<toolkit:ListPickerItem Content="E" />
<toolkit:ListPickerItem Content="F" />
<toolkit:ListPickerItem Content="G" />
<toolkit:ListPickerItem Content="H" />
</toolkit:ListPicker>
</ListBoxItem>
如果我降低不了。的项目到4,然后它正常工作,但它崩溃超过4个项目。
我正在尝试创建一个用户可以从中选择的字母列表。
发布于 2014-03-01 20:00:45
这是个众所周知的问题。
必须绑定这些项才能使用超过5项。
Codeplex解释
ListPicker作为ItemsControl,将其Items属性设置为示例中的ListPickerItems列表。ListPickerItems是UIElements,ListPicker在它的演示程序中呈现它们。当有5个或更少的项目时,展开模式将在当前页面上打开,您可以看到演示者中的所有项目。 但是,当出现6个或更多项时,打开列表选择器将进入完全模式,从而打开一个新页面。这个新页面有一个列表框,它将其items属性设置为列表选择器的项。这就是它断裂的地方。通过将列表框的项设置为列表选择器的项(在本例中是列表拾取项的列表),列表框将将这些UIElements放入其视图中。现在,在可视树的两个位置都包含了一个列表框项。 由于这个问题,ListPicker只支持数据库化和模板化。不要将ListPicker的项设置为特定的UIElements。
https://stackoverflow.com/questions/22119053
复制相似问题