Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF: Vertical expander conatining a ListView doesn't expand properly
    primarykey
    data
    text
    <p>I have an expander containing a list view. The expander is initially disabled, and enabled sometime after the application is started.</p> <p>Everything works great if before InitializeComponent() I populate the ListView's ItemsSource (some observable collection, created of course before InitializeComponent) with at least one item. The expander expands correctly, items show as they should. The only problem then is that new items that require more space to be rendered appear cropped - I assume this means the ListView isn't refreshing properly?</p> <p><strong>However</strong>, if I add items to the collection anytime after InitializeComponent(), the expander only expands a little bit (just a few pixels). When I force the ListView's Width to be some large value, the expander does expand, but items inserted into the list are rendered just with the background color, with no content...</p> <p>I assume this has something to do with the ListView initialization, refresh or what have you. Code follows:</p> <p>XAML:</p> <pre><code>&lt;DockPanel Name="mainPanel"&gt; &lt;Expander DockPanel.Dock="Right" ExpandDirection="Right" IsExpanded="False" IsEnabled="{Binding ExpanderEnabled}"&gt; &lt;Expander.Style&gt; &lt;Style TargetType="Expander"&gt; &lt;Setter Property="Background" Value="#FFFF3333" /&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding ExpanderEnabled}" Value="True"&gt; &lt;Setter Property="Background" Value="LightGreen" /&gt; &lt;/DataTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/Expander.Style&gt; &lt;Expander.Header&gt; &lt;Grid Width="30" VerticalAlignment="Top" HorizontalAlignment="Left"&gt; &lt;Grid Width="300" Height="300" VerticalAlignment="Top" HorizontalAlignment="Left"&gt; &lt;TextBlock Text="Expander Name" FontSize="12" FontWeight="Bold" Margin="22,170,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" RenderTransformOrigin="0,1"&gt; &lt;TextBlock.RenderTransform&gt; &lt;TransformGroup&gt; &lt;ScaleTransform/&gt; &lt;SkewTransform/&gt; &lt;RotateTransform Angle="-90"/&gt; &lt;TranslateTransform/&gt; &lt;/TransformGroup&gt; &lt;/TextBlock.RenderTransform&gt; &lt;/TextBlock&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/Expander.Header&gt; &lt;ListView ItemsSource="{Binding Items}" BorderBrush="LightGreen" BorderThickness="3"&gt; &lt;ListView.Style&gt; &lt;Style TargetType="ListView"&gt; &lt;Style.Resources&gt; &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Black"/&gt; &lt;/Style.Resources&gt; &lt;/Style&gt; &lt;/ListView.Style&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridView.ColumnHeaderContainerStyle&gt; &lt;Style TargetType="{x:Type GridViewColumnHeader}"&gt; &lt;Setter Property="Visibility" Value="Collapsed"/&gt; &lt;/Style&gt; &lt;/GridView.ColumnHeaderContainerStyle&gt; &lt;GridViewColumn DisplayMemberBinding="{Binding Path=A, Converter={StaticResource aConverter}}" Width="Auto" /&gt; &lt;GridViewColumn DisplayMemberBinding="{Binding Path=B, Converter={StaticResource bConverter}}" Width="Auto" /&gt; &lt;GridViewColumn DisplayMemberBinding="{Binding Path=C, Converter={StaticResource cConverter}}" Width="Auto" /&gt; &lt;GridViewColumn DisplayMemberBinding="{Binding Path=D, StringFormat='\{0\} ds'}" Width="Auto" /&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; &lt;/Expander&gt; ... </code></pre> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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