【问题标题】:CarouselPanel in UWP throwing exceptionUWP 中的 CarouselPanel 引发异常
【发布时间】:2017-01-18 23:34:17
【问题描述】:
        <ListView ItemsSource="{Binding PageViewModel.TestCollection, Mode=OneWay}">
        <ListView.ItemTemplate>
            <DataTemplate x:DataType="local:TestClass">
                <TextBlock >Blah</TextBlock>
            </DataTemplate>
        </ListView.ItemTemplate>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <CarouselPanel />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ListView>

只是尝试使用此控件。它在部署期间在 App.g.i.cs 中构建但挂起:

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
        UnhandledException += (sender, e) =>
        {
            if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
        };

我尝试了几种类型的集合,但得到了相同的错误。

【问题讨论】:

  • 当 Visual Studio 在 UnhandledException 处理程序上遇到中断时,您可以将鼠标悬停在 (sender, e) 部分中的 e 参数上并查看发生的确切异常。请执行此操作并使用此异常的详细信息更新帖子。

标签: c# xaml uwp


【解决方案1】:

如果您查看异常的Message,您会看到:

您用于控件的面板不允许作为控件的 ItemsPanel。

因此,您只能将CarouselPanelComboBox 控件一起使用。

【讨论】:

  • 谢谢我的错误。显然,在 Win 8 发布期间,它曾一度允许在其他控件中使用。
猜你喜欢
  • 2019-01-29
  • 2017-11-04
  • 1970-01-01
  • 2016-03-13
  • 2016-11-22
  • 2016-11-04
  • 2017-05-18
  • 2019-10-30
  • 2018-07-10
相关资源
最近更新 更多