首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >System.Exception {System.ArgumentException}值不属于预期范围

System.Exception {System.ArgumentException}值不属于预期范围
EN

Stack Overflow用户
提问于 2014-03-01 19:14:30
回答 1查看 2.2K关注 0票数 0

每当我试图访问我的应用程序中的m列表选择器控件时,我就会得到这个异常。

代码语言:javascript
运行
复制
+       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      

我的列表选择器的代码是

代码语言:javascript
运行
复制
<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个项目。

我正在尝试创建一个用户可以从中选择的字母列表。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-01 20:00:45

这是个众所周知的问题。

必须绑定这些项才能使用超过5项。

Codeplex解释

ListPicker作为ItemsControl,将其Items属性设置为示例中的ListPickerItems列表。ListPickerItems是UIElements,ListPicker在它的演示程序中呈现它们。当有5个或更少的项目时,展开模式将在当前页面上打开,您可以看到演示者中的所有项目。 但是,当出现6个或更多项时,打开列表选择器将进入完全模式,从而打开一个新页面。这个新页面有一个列表框,它将其items属性设置为列表选择器的项。这就是它断裂的地方。通过将列表框的项设置为列表选择器的项(在本例中是列表拾取项的列表),列表框将将这些UIElements放入其视图中。现在,在可视树的两个位置都包含了一个列表框项。 由于这个问题,ListPicker只支持数据库化和模板化。不要将ListPicker的项设置为特定的UIElements。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22119053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档