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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:17:30+00:00 2026-05-11T21:17:30+00:00

I want to apply a format (align text, format for the currency 0000.00) to

  • 0

I want to apply a format (align text, format for the currency 0000.00) to the columns in the GridViewColumn.

 <GridViewColumn TextBlock.TextAlignment="Center" Width="80" DisplayMemberBinding="{Binding XPath=Name}"/>

The idea is the following one: In the columns (GridViewColumn) the text that our could apply a format to him (Aligners on the left, right, center, justify, etc.).

In the following code they can see the different attempts without obtaining any result

The code is as follows:

 <Window x:Class="ListViewTest.Test0.ListViewTest"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   Title="Empty ListView Grid" Height="216" Width="435" FlowDirection="LeftToRight" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.IsSharedSizeScope="False">
    <Window.Resources>
        <XmlDataProvider x:Key="CustomersDS" Source="C:\data.xml"/>
        <Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Visibility" Value="Collapsed" />
        </Style>
    </Window.Resources>



    <ListView Margin="0,0,0,50" ItemTemplate="{DynamicResource CustomerTemplate}" ItemsSource="{Binding Source={StaticResource CustomersDS}, XPath=/Customers/Customer}">
        <ListView.View>
            <!--ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}"-->
            <GridView >
                <GridViewColumn Width="80" TextBlock.TextAlignment="Center">
                    <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock HorizontalAlignment="Center" Text="{Binding XPath=Code}"></TextBlock>
                    </DataTemplate>
                  </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <GridViewColumn TextBlock.TextAlignment="Center" Width="80" DisplayMemberBinding="{Binding XPath=Name}"/>
                <GridViewColumn Width="120" TextBlock.TextAlignment="center" DisplayMemberBinding="{Binding XPath=Country}"/>
                <GridViewColumn Width="120" TextBlock.TextAlignment="center" DisplayMemberBinding="{Binding XPath=money}"/>
            </GridView>
        </ListView.View>
    </ListView>


</Window>

XML

     <Customers>
  <Customer>
 <Code>1234</Code>
 <Name>EPI</Name>
 <Country>Sesame Street</Country>
<money> 98.00</money>
  </Customer>
  <Customer>
 <Code>3234</Code>
 <Name>Paul</Name>
 <Country>United Kingdom</Country>
<money> 8.70</money>
  </Customer>
 <Customer>
 <Code>3344</Code>
 <Name>Juan</Name>
 <Country>Spain</Country>
<money> 785.5</money>
  </Customer>
 <Customer>
 <Code>4321</Code>
 <Name>Dodo</Name>
 <Country>Venezuela</Country>
<money> 150.02</money>
  </Customer>
</Customers>
  • 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-11T21:17:31+00:00Added an answer on May 11, 2026 at 9:17 pm

    Here is how I did something similar (format and align a currency column):

    <GridViewColumn Header="Amount">
        <GridViewColumn.CellTemplate>
            <DataTemplate>
                <TextBlock TextAlignment="Right"
                           Text="{Binding Path=Amount, StringFormat='{}{0:C}'}" />
            </DataTemplate>
        </GridViewColumn.CellTemplate>
    </GridViewColumn>
    

    I also added this style:

    <Style TargetType="ListViewItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>
    

    If you aren’t using .NET 3.5 SP1, you’ll need to use a converter instead of the StringFormat.

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

Sidebar

Related Questions

What if you want to apply a function other than format to a list
I want to apply two different font styles to a text in a single
I don't know much about skins. I want to apply a common format for
I want to apply the % (percentage) number format using open XML C# I
I want to find which Currency Symbol exists in Currency Format data. For example,
I want apply margin property for my html newsletter But Gmail ignores this CSS
I want to apply texture to the transparent png(bitmap), but I don't want to
I want to apply scaling animation to UIButton.When user drag button upside of the
i want to apply masking over the textinput that need to get SSN from
I want to apply the following Style to my Polygon : <Style xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:s=clr-namespace:System;assembly=mscorlib

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.