1

I would like to know if it is possible to add text to a datagrid column value?

    <DataGridTextColumn Binding="{Binding TotalEuro}" Header="Total €" MinWidth="100" MaxWidth="120" IsReadOnly="True"/>

Lets say I have the value "240" that I get from a database, now what I need is for it to display as "€ 240". Any advice would be greatly appreciated! :)

2 Answers 2

2

You should use stringformat

<DataGridTextColumn Binding="{Binding TotalEuro, StringFormat=€ {0}}" Header="Total €" MinWidth="100" MaxWidth="120" IsReadOnly="True"/>
Sign up to request clarification or add additional context in comments.

Comments

1

You can use StringFormat to format your binding string and add the text do you need.

Example:

<DataGridTextColumn Binding="{Binding TotalEuro, StringFormat=€ {0}}" Header="Total €" MinWidth="100" MaxWidth="120" IsReadOnly="True"/>

Where {0} is your binding. If you need multibinding you can use {1}, {2} etc

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.