CodeProject, WPF


One of my WPF Disciple buddies just sent an email around asking about Binding.StringFormat. Mmm so now there is a Binding.StringFormat. Neat. So we can now do things like the following. If you want to see all the new stuff in the .NET 3.5 BETA, check out Scott Guthries blog, using this link .NET 3.5 SP 1


   1:      <Grid>
   2:          <TextBlock Text="{Binding ElementName=slider1,
   3:              Path=Value, SringFormat='Amount: {0:0.000}'}"
   4:              Height="21" Margin="44,37,65,0"
   5:              VerticalAlignment="Top" />
   7:          <Slider Value="58″ Margin="53,77,50,0"
   8:              Name="slider1" Height="24"
   9:              VerticalAlignment="Top"
  10:              Maximum="100" />
  11:      </Grid>

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

10 thoughts on “Binding.StringFormat

  1. Hum… It looks like your blog doesn’t like XML.
    Is the following better?

    [MultiBinding StringFormat=”Customer {0} has {1} orders”]
    [Binding Path=”Customer.Name”/]
    [Binding Path=”Customer.Orders.Count”/]

  2. Hey Paul,

    Thanks for the comment and congrats again on your excellent BindableLINQ (I have used some of your stuff in past, like Validation control that uses IDataErrorInfo)

    You do some cool stuff man, I think I use it over at codeproject, in this article if you are interested.

    I have a few 3D WPF ones that you may also like being a WPF man

    Have a look thourgh my articles see if any take your fancy

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s