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

  • SEARCH
  • Home
  • 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 8736533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:19:26+00:00 2026-06-13T10:19:26+00:00

I have wrote some class, named as Employe. Employees collection I set as source

  • 0

I have wrote some class, named as Employe. Employees collection I set as source for ListBox WPF control. I have wrote such template for ItemTemplate:

<ResourceDictionary>
    <DataTemplate x:Key="tmpEmploye">
        <Border BorderThickness="3" BorderBrush="Gray" CornerRadius="5" 
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=Surname}" 
                               HorizontalAlignment="Stretch" Margin="2" 
                               FontWeight="Bold" TextWrapping="Wrap"/>
                    <TextBlock Text="{Binding Path=Name}" 
                               HorizontalAlignment="Stretch" Margin="2"/>
                    <TextBlock Text="{Binding Path=Patronymic}" 
                               HorizontalAlignment="Stretch" Margin="2" 
                               TextWrapping="Wrap"/>
                </StackPanel>
                <TextBlock Text="{Binding Path=Post}" Foreground="Gray" 
                           HorizontalAlignment="Stretch" Margin="2" 
                           FontStyle="Italic" TextWrapping="Wrap"/>
            </StackPanel>
        </Border>                               
    </DataTemplate>            
</ResourceDictionary>

Each item has border. The border must be expanded according width of ListBox. I set HorizontalAlignment="Stretch" for Border, but it is not occured as I want.

enter image description here

How can I correct it?

  • 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-06-13T10:19:28+00:00Added an answer on June 13, 2026 at 10:19 am

    Try this:

    <ListBox Name="lbEmployees" ItemTemplate="{StaticResource tmpEmploye}"
                     HorizontalContentAlignment="Stretch"
                     />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input field with class named form_inputext1. I am doing some action
I am a beginner at using WPF. I have wrote some xaml code in
I have wrote some code to find out of 3 variables witch is the
I have wrote a script to do some backup. There is a if block
I have been refactoring throwaway code which I wrote some years ago in a
I have been reading about Scala for a while and even wrote some small
I have heard that prepared statements with SQLite should improve performance. I wrote some
I have this header file, zeeheader.h, and I wrote some classes in it, I'm
I have some python code that I wrote to convert a python list into
I have a graph representing users and some articles they wrote. I need to

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.