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 636705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:32:39+00:00 2026-05-13T20:32:39+00:00

I am populating a ListBox withe Shipment objects and I am using an ItemContainerStyle

  • 0

I am populating a ListBox withe Shipment objects and I am using an ItemContainerStyle to define how I want the items displayed. Everything is working smoothly with one exception.

The template uses a Grid that is inside of two borders. The grid has 7 columns, the last is specified to contain a border that will end up being a glowing gem to denote the active (not necessarily the selected package). The template is set to expand to the width of the listbox. And I cannot figure out how to get the gem to align to the right side of the container. Below is the XAML:

<Border Background="#FFFFB78F" Margin="-2,0,0,0">
<Border BorderBrush="#FF636363" BorderThickness="1" CornerRadius="8" Margin="0,2">
    <Border.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFFFCCB0" Offset="0"/>
            <GradientStop Color="#FFFFCCB0" Offset="1"/>
            <GradientStop Color="#FFFCE8DD" Offset="0.5"/>
        </LinearGradientBrush>
    </Border.Background>
    <Grid Margin="6,0,0,0" ScrollViewer.VerticalScrollBarVisibility="Disabled" ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="60" x:Name="Image"/>
            <ColumnDefinition Width="150" x:Name="Names"/>
            <ColumnDefinition Width="120" x:Name="Address"/>
            <ColumnDefinition Width="120" x:Name="Dates"/>
            <ColumnDefinition  Width="200" x:Name="OtherInfo"/>
            <ColumnDefinition  Width="Auto" />
            <ColumnDefinition Width="30"/>
        </Grid.ColumnDefinitions>
        <Image x:Name="CarrierImage" Grid.Column="0" Margin="7,0" Height="45" Width="50"/>
        <StackPanel Grid.Column="1" Margin="4,4,4,0">
        </StackPanel>
        <StackPanel Grid.Column="2" Margin="4,4,4,0">
            <StackPanel Orientation="Horizontal">
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Column="3" Margin="4,4,4,0">
        </StackPanel>
        <StackPanel Grid.Column="4" Margin="4,4,4,0">
        </StackPanel>
           <!-- Gem -->
        <Border HorizontalAlignment="Right" Margin="0,8,5,7" Width="15" Height="Auto" BorderBrush="Black" BorderThickness="1" CornerRadius="5" Grid.Column="6" d:LayoutOverrides="GridBox">
            <Border.Background>
                <RadialGradientBrush>
                    <GradientStop Color="#FF760000" Offset="1"/>
                    <GradientStop Color="Red"/>
                    <GradientStop Color="#FEFF0000" Offset="0.15"/>
                </RadialGradientBrush>
            </Border.Background>
        </Border>
        <Grid Margin="0,0,-298.067,0" VerticalAlignment="Top" Height="13.277" Grid.Column="6" >
        </Grid>
    </Grid>
</Border>
</Border>

The Gem Border is toward the bottom. Initially I created the containing grid with a column set to Auto in the hopes that it would fill the remaining space, pushing the last column over to the right edge, but grid columns don’t really work that way. I also tried putting a hidden textblock filled with space characters in there to try and get it to expand (hoping that it would continue to constrain itself to the list boxes width, also to no avail.

  • 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-13T20:32:40+00:00Added an answer on May 13, 2026 at 8:32 pm

    To expand to remaining space you need a column set to Width=”*”. Auto indicates that the column should size to fit its contents, where * indicates that it should fill its parent.

    Without seeing the rest of your XAML I expect that you’re also getting the default Left alignment for your ListBoxItems so just the * width will give you the same behavior. You can fix that by setting HorizontalContentAlignment=”Stretch” on the parent ListBox (unless you have other things going on with your ListBox layout not shown here).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 384k
  • Answers 384k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Morphia isn't a driver but a wrapper around the official… May 14, 2026 at 11:16 pm
  • Editorial Team
    Editorial Team added an answer Yes. The problem with your code is that you're making… May 14, 2026 at 11:16 pm
  • Editorial Team
    Editorial Team added an answer I'm the OP. I'm combining Eric Seppanen's & Matteo Italia's… May 14, 2026 at 11:16 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.