Setting ListView.GroupStyle in XAML dynamically?
I've got a 开发者_如何转开发ListView, whose View is switched dynamically in runtime between an Icon mode and a Grid mode (the latter implemented with a GridView). The problem is, as I described here, that when I add ListView.GroupStyle in my ListView definition, the Icon mode gets screwed. Hence, I'd like to reset/disable GroupStyle for that mode.
So, my question: is there a way to apply/reset the GroupStyle dynamically (via a Trigger?) when I switch the ListView into the Grid mode?
I tried to do that (e.g. <Setter Property="ListView.GroupStyle" Value="{x:Null}"/>) for the Icon View, but this doesn't compile because "The Property Setter 'GroupStyle' cannot be set because it does not have an accessible set accessor."
Any suggestions will be cordially welcome :-)
There could be two ways to do this...
Instead of setting the
GroupStyletox:Nullkeep the existing setGroupStyleas it is, but reset its inner template usingDataTriggers that useTemplateBinding.Use bottom up approach, remove your
GroupDescriptionsfrom yourCollectionViewbased on the mode.
加载中,请稍侯......
精彩评论