Free download wpf converter two way binding for windows 10

DOT NET TRICKS

Handy Tricks and Tips to do your .NET code Fast, Efficient and Simple. Some common questions that comes into mind. Please check if you could find them listed or not.

How to use IValueConverter in Binding of WPF

IValueConverter

Converter is actually a property within the Binding Markup Extension. Its type is defined as IValueConverter . Every time the bound data elements refreshes its value it passes through a method Convert which is defined inside the object Converter (if found). Thus Converter acts as an interface to manipulate the actual data before passing it to the property.

To use the Converter you need to create a resource of the object. Thus in XAML you need to declare :

Where local is the namespace added which points to the Current Namespace. Finally to define the Converter, you need to use this as StaticResource in the Converter.

Remember one thing, in the above line, you need to make sure you are clear about what you are sending. In this case, we are binding Height with the ActualHeight of the element win. So, in the arguments of Convert, you will receive a double value with current ActualHeight , and you are going to return the value that you want to be set to Height. So actually you are sending a double value and returning another.

0 comments:

Post a Comment

Please make sure that the question you ask is somehow related to the post you choose. Otherwise you post your general question in Forum section.

Author's new book

Blog Subscription

Learn MVC 5 step by step

Please try it, you will find it awesome.

Hit Counter

Best .NET 4.5 Expert CookBook

Another book on .NET 4.5 has been released very recently. It covers Debugging, Testing, Extensibility, WCF, Windows Phone, Windows Azure and many more.

The Programmers Newspaper

To Get your free copy, Click here.

Join the TEAM

Blogs I follow

Blog Archive

  • ► 2015 (2)
    • ► March (2)
  • ► 2014 (1)
    • ► November (1)
  • ► 2013 (5)
    • ► July (1)
    • ► June (1)
    • ► May (1)
    • ► April (1)
    • ► February (1)
  • ► 2012 (6)
    • ► August (1)
    • ► March (1)
    • ► February (2)
    • ► January (2)
  • ► 2011 (58)
    • ► December (1)
    • ► November (1)
    • ► October (4)
    • ► September (4)
    • ► August (3)
    • ► July (7)
    • ► June (6)
    • ► May (4)
    • ► April (8)
    • ► March (7)
    • ► February (6)
    • ► January (7)
  • ▼ 2010 (90)
    • ► December (6)
    • ► November (7)
    • ► October (8)
    • ► September (11)
    • ► August (11)
    • ► July (10)
    • ► June (10)
    • ► May (8)
    • ► April (7)
    • ▼ March (11)
      • Manipulate your ClientID in ASP.NET 4.0
      • Fun with Borders - Brushes & Effects
      • Another Couple of Articles Published @WindowsClien.
      • Create a Base Window / UserControl in WPF
      • Article Selected @Windowsclient.net Again.
      • Resolution Independent Layout Fix in WPF
      • How to use IValueConverter in Binding of WPF
      • Another article Published @WindowsClient.net
      • “Article of the day” @ Microsoft’s official websit.
      • Multilingual Application using WPF
      • Try Text to Speech for your application
    • ► January (1)
  • ► 2009 (5)
    • ► November (1)
    • ► September (1)
    • ► August (1)
    • ► June (1)
    • ► February (1)
  • ► 2008 (4)
    • ► October (2)
    • ► September (1)
    • ► April (1)

Popular Posts

About Me

Codeproject MVP, Associate | Dotnetfunda MVP | Kolkata .NET Star | Writer | Technology Evangelist | Technology Lover | Geek | Speaker View my complete profile