Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In general, you can look for an associated <code>*StringFormat</code> dependency property. For example, all <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contentcontrol.aspx" rel="noreferrer">ContentControl</a> implementations (such as Label and Tooltip) have the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.contentcontrol.contentstringformat.aspx" rel="noreferrer">ContentStringFormat dependency property</a>:</p> <pre><code>&lt;Label Content="{Binding Path=DateAsked}" ContentStringFormat="{}{0:yyyy/MM/dd HH:mm:ss}" /&gt; </code></pre> <p>In your case, while the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn.aspx" rel="noreferrer">GridViewColumn</a> has the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn.headerstringformat.aspx" rel="noreferrer">HeaderStringFormat dependency property</a> to go along with <code>Header</code>, there is no analog for the <code>DisplayMemberBinding</code> and so you will need .NET 3.5 SP1 (get it with <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;displaylang=en" rel="noreferrer">Visual Studio 2008 SP1</a>) or better to use the new <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.stringformat%28v=VS.90%29.aspx" rel="noreferrer">BindingBase.StringFormat Property</a>:</p> <pre><code>&lt;GridViewColumn Header="Order ID" DisplayMemberBinding="{Binding Path=OrderID, StringFormat='{}{0:dd.MM.yyyy}'}" /&gt; </code></pre> <p>There are lots more examples at the blog post <a href="http://blogs.msdn.com/b/mikehillberg/archive/2008/05/29/trying-out-binding-stringformat.aspx" rel="noreferrer">Trying out Binding.StringFormat</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload