GroupStyle HidesIfEmpty里面是否有错误? [英] Is there a bug inside GroupStyle HidesIfEmpty?

查看:116
本文介绍了GroupStyle HidesIfEmpty里面是否有错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows Phone 8.1 WinRT应用程序。我使用SemanticZoom + ListView组合通过CollectionViewSource显示分组列表。 当我从所有组中删除所有项目(它们是ObservableCollections),并开始将项目返回到这些空组时,调试器将会以agip。*显示。某些地方读取DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION;这个以前发生了一段时间,但现在是因为我不知道我的应用程序只是退出和调试停止没有任何错误消息;这就是为什么我不记得确切的文件名。



我有两个问题:



1)让调试器再次工作,即显示agip。*页面,而不是只是静默地退出?



2)通过反复尝试,我设法追踪原因通过将
< ListView.GroupStyle>< GroupStyle HidesIfEmpty =true
更改为$ code>< ListView。 GroupStyle>< GroupStyle HidesIfEmpty =false。
而且我的应用程序没有任何问题。这可能是WinRT中的一个错误?



PS:我可以通过转换器将组头可见性绑定到.items.count来实现HidesIfEmpty行为,因此这不是问题

解决方案

回答您的问题




1)如何让调试器再次工作,即显示agip。*页面,而不是静默地退出?


尝试这个打开异常设置窗口:菜单调试 - > Windows - >异常设置。检查所有异常类别。
但是,我没有得到它的工作。即使在附加另一个Visual Studio实例来调试devenv.exe进程并处理所有异常的情况下,它只会中断一个未处理的win32exceptions,而不会发现它在哪里发生,也不会提供异常的任何细节。 >


2)通过尝试和错误,我设法通过更改< ListView.GroupStyle>< GroupStyle HidesIfEmpty =true到< ListView.GroupStyle>< GroupStyle HidesIfEmpty =false。而且我的应用程序没有任何问题。这可能是WinRT中的错误吗?


看起来像是一个错误。



您的解决方法




我可以通过转换器将组头可见性绑定到.items.count来实现HidesIfEmpty行为,这不是一个这个问题在这里。


这种方法在Windows 10上看起来不太好,例如,组头在底部有一个边框。所以隐藏TextBlock不会完全隐藏组头。 (也许我做错了)



我用不同的方式解决了问题。



另一个解决方法



清除分组集合中的每组后,尝试延迟。像这样:

  foreach(GroupsCollection中的var group)
{
group.Clear();
等待延迟(1); //这是解决方法
group.Add(newItem);
}

这在我的情况下有所帮助。


I have a Windows Phone 8.1 WinRT application. I am using SemanticZoom + ListView combination to display a grouped list through a CollectionViewSource. When I remove all items from all the groups (which are ObservableCollections) and start putting the items back to these empty groups the debugger breaks and shows up with "agip.*" something at a point where it reads DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION; This used to happen for a while but now for a reason I do not know my app just exits and debugging stops without any error message; This is why I cannot remember the exact filename.

I have two questions:

1) How can I get the debugger work again i.e. to display that "agip.*" something page and not just silently quit?

2) By trial and error I managed to track down the cause of this by changing <ListView.GroupStyle><GroupStyle HidesIfEmpty="true" to <ListView.GroupStyle><GroupStyle HidesIfEmpty="false". And voila my app works without any problems. Could this be a bug in the WinRT?

PS: I can achieve HidesIfEmpty behaviour by binding group header visibility to .items.count through a converter so that's not an issue here.

解决方案

Answering your questions

1) How can I get the debugger work again i.e. to display that "agip.*" something page and not just silently quit?

Try this. Open the Exception settings window: menu Debug -> Windows -> Exception settings. Check all the exception categories. However, I didn't get it to work. It simply breaks with an unhandled win32exceptions, not giving any idea of where did it occur and doesn't give any details on the exception, even when attaching another Visual Studio instance to debug the devenv.exe process with all exceptions handled.

2) By trial and error I managed to track down the cause of this by changing <ListView.GroupStyle><GroupStyle HidesIfEmpty="true" to <ListView.GroupStyle><GroupStyle HidesIfEmpty="false". And voila my app works without any problems. Could this be a bug in the WinRT?

Looks like it is a bug.

Your workaround

I can achieve HidesIfEmpty behaviour by binding group header visibility to .items.count through a converter so that's not an issue here.

This approach doesn't look good on Windows 10, for example, where the group header has a border on the bottom. So hiding the TextBlock doesn't hide the group header completely. (Maybe I'm doing something wrong).

I solved the problem in a different way.

Another workaround

After clearing each group of the grouped collection, try to make a delay. Like this:

foreach(var group in GroupsCollection)
{
    group.Clear();
    await Delay(1); // this is workaround
    group.Add(newItem);
}

This has helped in my case.

这篇关于GroupStyle HidesIfEmpty里面是否有错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆