Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4550818
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:32:56+00:00 2026-05-21T16:32:56+00:00

I am having a kinda strange problem. Here is the situation. I have a

  • 0

I am having a kinda strange problem.

Here is the situation. I have a ListView, with a custom defined GroupStyle to make data appear in Expanders, in which there is a WrapPanel containing StackPanels (which contain one ToggleButton + one custom control)
The custom control in the StackPanel is not visible by default, and becomes visible when the ToggleButton is checked.
However, when I check a ToggleButton, the custom control appears, and all the other control situated on the same line will move to a vertical center.
Ideally, I’d like these other members to stay on top. I’ve tried to set VerticalAlignment="Top" everywhere I could, it doesn’t change anyway.

Imaged problem:

The initial state of an expander:

Expander before

Once the ToggleButton is clicked, here is what happens:

Expander after

As you can see, the button “Test Analysis” is moved to stay at the center. I want it to stay in the same place than the original.

Moreover, I’ve defined all of these styles in separate DataTemplates objects.
Here is some light code (I just removed what’s useless for the problem here, won’t make you read tons of XAML code 🙂 ):

The expander’s content property:

<Expander.Content>
    <WrapPanel Background="White" VerticalAlignment="Top">
        <ItemsPresenter VerticalAlignment="Top"/>
    </WrapPanel>
</Expander.Content>

The list’s ItemsPanel :

<ItemsPanelTemplate >
    <WrapPanel 
         Width="{Binding (FrameworkElement.ActualWidth),
         RelativeSource={RelativeSource 
                         AncestorType=Expander}}"
         ItemWidth="{Binding (ListView.View).ItemWidth,
         RelativeSource={RelativeSource AncestorType=ListView}}"

         ItemHeight="{Binding (ListView.View).ItemHeight,
         RelativeSource={RelativeSource AncestorType=ListView}}" />
</ItemsPanelTemplate>

The list’s ItemsTemplate :

<StackPanel Orientation="Vertical" Height="Auto" Width="Auto" VerticalAlignment="Top" >
    <ToggleButton BorderBrush="{x:Null}" Background="{x:Null}" IsChecked="{Binding Value.IsToLaunch, Mode=TwoWay}"
              Command="{Binding DataContext.UpdateGroupCheckingsCommand,
                                RelativeSource={RelativeSource FindAncestor,
                                AncestorType={x:Type UserControl}}}">
        <Grid Background="Transparent">
            <!-- Blah blah blah about the ToggleButton's content -->

        </Grid>
    </ToggleButton>

    <my:UcReleaseChooser>
        <!-- Blah blah blah about being visible if ToggleButton is Checked -->
    </my:UcReleaseChooser>
</StackPanel>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:32:57+00:00Added an answer on May 21, 2026 at 4:32 pm

    Try setting the verticalalignment property to Top or the VerticalContentAlignment property of the listview to Stretch

       <Style TargetType="ListView">
            <Setter Property="VerticalContentAlignment" Value="Top"/>
        </Style>
    

    or

        <ListView.ItemContainerStyle>
            <Style TargetType="ListViewItem">
                <Setter Property="VerticalContentAlignment" Value="Stretch" />
            </Style>
        </ListView.ItemContainerStyle>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a problem getting a TreeView control to display node images. The code below
I'm having issues with a script that I made for use in HTML5. Here
I am having quite a tricky problem, which i just cannot seem to solve.
When declaring a template, I am used to having this kind of code: template
Kind of a basic question but I'm having troubles thinking of a solution so
I'm having to open the firefox error console, which is kind of annoying.
In general, what kinds of design decisions help an application scale well? (Note: Having
Having been a PHP developer on LAMP servers for quite a while, is there
Having a heckuva time with this one, though I feel I'm missing something obvious.
Having worked with Classic ASP for about 2 years now by creating a few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.