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
GroupStyle
tox:Null
keep the existing setGroupStyle
as it is, but reset its inner template usingDataTrigger
s that useTemplateBinding
.Use bottom up approach, remove your
GroupDescriptions
from yourCollectionView
based on the mode.
精彩评论