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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:44:51+00:00 2026-05-11T19:44:51+00:00

Most common way I encountered of specifying a value converter for a binding is

  • 0

Most common way I encountered of specifying a value converter for a binding is to:
1. Create an instance of the value converter as a resource with a key.
2. Reference the instance using StaticResource markup extension:

<TextBlock Text="{Binding Converter={StaticResource myFormatter}" />  

Q: Is there anything wrong with using static instance as follows:

<TextBlock Text="{Binding Path=Description, Converter={x:Static local:MyFormatter.Instance}}"/>

// where Instance is declared as:
public readonly static MyFormatter Instance = new MyFormatter();

In my case value converter is immutable.

Edit: another way is to turn the converter into an extension
so that you specify the converter using markup extension format:

<TextBlock Text="{Binding Converter={local:MyFormatter}}"/>
  • 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-11T19:44:51+00:00Added an answer on May 11, 2026 at 7:44 pm

    Technically it will be fine, but in practice I don’t like it:

    1. If you declare the converter as a resource, then you have a single point of reference. If you change the namespace or class name of the converter, then you only have a single place to update.

    2. If you declare it as static, then you need to bring the clr-namespace in at the top of each and every xaml file that uses the converter. If you declare it as a resource, you don’t.

    3. {Binding Converter={StaticResource myFormatter} is much shorter and easier to read than the static one. In the long run, this will help you more than you might think.

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

Sidebar

Related Questions

What's the most common way to deal with a series of block elements that
Whats the most common way of instantiating VB6 ActiveX controls inside of an Tcl/Tk
What's the most common/best way to setup a WCF service project and applications? Here's
What are the most common things to test in a new site? For instance
When calling a JSON-RPC service what is the most common way to generate a
What is the most common way to organise web content, i.e. HTML, JS and
Since Regular Expressions seem to accept only string, the most common way to search
Let's create a complementary question to this one . What is the most common
What is the most common way people preserve basic formatting elements like bold emphasis
Most common ORMs implement persistence by reachability, either as the default object graph change

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.