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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:42:56+00:00 2026-05-17T06:42:56+00:00

I have following WPF ListView: <ListView Grid.Column=2 Grid.Row=1 Margin=0,53,12,6 Name=lvwProperties ItemsSource={Binding Path=SelectedPropertyItems, Mode=TwoWay} Grid.ColumnSpan=2>

  • 0

I have following WPF ListView:

    <ListView Grid.Column="2" Grid.Row="1" Margin="0,53,12,6" 
Name="lvwProperties" 
ItemsSource="{Binding Path=SelectedPropertyItems, Mode=TwoWay}" 
Grid.ColumnSpan="2">

        <ListView.View >

                        <GridView>
                            <GridViewColumn Header="Property" DisplayMemberBinding="{Binding Path=PropertyName, Mode=TwoWay}" Width="130" />
                            <GridViewColumn Header="Is Mandatory" Width="90"  >

                                <GridViewColumn.CellTemplate>

                                    <DataTemplate>

                                        <CheckBox IsChecked="{Binding Path=IsMandatory, Mode=TwoWay}" HorizontalAlignment="Center" />

                                    </DataTemplate>

                                </GridViewColumn.CellTemplate>

                            </GridViewColumn>

                        </GridView>
                    </ListView.View>
                </ListView>

I want to make the CheckBox aligned center in the 2nd GridColumn. Set the HorizontalAlignment="Center" seems doesn’t do the trick. How to achive this in XAML???

  • 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-17T06:42:57+00:00Added an answer on May 17, 2026 at 6:42 am

    To center content in a ListView you need to set ListView.ItemContainerStyle to have a horizontal alignment of Stretch as follows:

    <ListView Grid.Column="2" Grid.Row="1" Margin="0,53,12,6" Name="lvwProperties"  
              ItemsSource="{Binding Path=SelectedPropertyItems, Mode=TwoWay}"  
              Grid.ColumnSpan="2"> 
        <ListView.ItemContainerStyle>
           <Style TargetType="ListViewItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
           </Style>
        </ListView.ItemContainerStyle>
        <ListView.View> 
            <GridView> 
                <GridViewColumn Header="Property" DisplayMemberBinding="{Binding Path=PropertyName, Mode=TwoWay}" Width="130" /> 
                <GridViewColumn Header="Is Mandatory" Width="90"  > 
                   <GridViewColumn.CellTemplate> 
                       <DataTemplate> 
                           <CheckBox IsChecked="{Binding Path=IsMandatory, Mode=TwoWay}" HorizontalAlignment="Center" /> 
                       </DataTemplate> 
                   </GridViewColumn.CellTemplate> 
                </GridViewColumn> 
            </GridView> 
        </ListView.View> 
    </ListView> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following DataGrid in wpf. <DataGrid AutoGenerateColumns=False Grid.Row=1 Name=adsGrid ItemsSource={Binding Path=Ads} CanUserAddRows=False CanUserDeleteRows=False
I have the following wpf control added to xaml: <ListView Margin=22,80,271,12 Name=listView1 ItemsSource={Binding} />
I have the following XAML markup in a WPF DataGrid: <DataGrid ItemsSource={Binding ResultList} Grid.ColumnSpan=4
I have the following simpl WPf grid, two columns, a button in each column,
I have the following xaml which resides in a wpf user control - <Grid>
I have the following grid in my WPF Window (yes the class Window); <Grid
I have the following Combo box binding which was within a WPF window. I
I have the following ControlTemplate for a WPF TabItem: <ControlTemplate x:Key=DefaultTabItemTemplate TargetType={x:Type TabItem}> <ControlTemplate.Resources>
I have the following dependency property in my MainWindow class (inherits from WPF's Window)
I have the following xaml for changing the image for WPF button when mouse

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.