Note that there are some explanatory texts on larger screens.

plurals
  1. POExpander grouping collapses after source reset
    primarykey
    data
    text
    <p>I have a listbox with a bit of templating. Groups are represented by expanders. The listbox is linked to the filesystem and each folder gets its own expander. Any time a file is renamed, deleted, etc, the listbox's view is refreshed. This works great but once the refresh is called, each of the expanders collapses. I can't seem to find a good way to keep them open. I saw another question that used binding to solve this for a single expander. The issue with a data binding on the "IsExpanded" is that there are an unknown number of expanders and I have no way of knowing how many there will be, what they will be called, etc at design time. Any ideas?</p> <pre><code>&lt;ListBox.GroupStyle&gt; &lt;GroupStyle&gt; &lt;GroupStyle.ContainerStyle&gt; &lt;Style TargetType="{x:Type GroupItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type GroupItem}"&gt; &lt;Expander VerticalAlignment="Top" OverridesDefaultStyle="True" Template="{StaticResource SimpleExpanderTemp}"&gt; &lt;Expander.Header&gt; &lt;TextBlock VerticalAlignment="Center" Background="Transparent" Text="{Binding Path=Name}" FontFamily="SegoeUI" FontSize="16" Foreground="Black"/&gt; &lt;/Expander.Header&gt; &lt;Expander.Tag&gt; &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt; &lt;GradientStop Offset="0.0" Color="#696969" /&gt; &lt;GradientStop Offset="1.0" Color="#474747" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Expander.Tag&gt; &lt;ItemsPresenter/&gt; &lt;/Expander&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/GroupStyle.ContainerStyle&gt; &lt;/GroupStyle&gt; &lt;/ListBox.GroupStyle&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload