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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:22:20+00:00 2026-05-23T02:22:20+00:00

I have a delegate type: public delegate bool CheckFormatDelegate(int row, int col, ref string

  • 0

I have a delegate type:

public delegate bool CheckFormatDelegate(int row, int col, ref string text);

This has been used in a Property on a Xaml object:

public virtual CheckFormatDelegate CheckFormat { get; set; }

I set the property value to one of a group of delegates, for example:

public class FCS
{
    public static bool FormatDigitsOnly(int row, int col, ref string text)
    {
        ...
    }
}

If I set the property in codebehind, all is well. However, if I set it in Xaml:

<mui:DXCell CheckFormat="mui:FCS.FormatDigitsOnly"/>

when I run my app I get an exception: “‘CheckFormatDelegate’ type does not have a public TypeConverter class.”. Does anyone know if there’s a built in set of converters/markup extensions like the ones used for RoutedEvent? Or is there some other way around this?

  • 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-23T02:22:21+00:00Added an answer on May 23, 2026 at 2:22 am

    The error you are getting is because it is trying to convert a string into something meaningful to the XAML compiler. You might be able to create a type converter for it (implemented with reflections), but there are simpler ways to work around this.

    Use the x:Static markup extension.

    <object property="{x:Static prefix:typeName.staticMemberName}" ... />
    

    See the MSDN docs:

    http://msdn.microsoft.com/en-us/library/ms742135.aspx

    According to that page:

    … most of the useful static properties have support such as type converters that facilitate the usage without requiring {x:Static} …

    I’m guessing your custom delegate does not, and would require you to use x:Static.

    Edit

    I tried it out, and it doesn’t seem to work on methods, as you mentioned. But it does work against properties. Here is a work-around:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:local="clr-namespace:WpfApplication1"
            Title="MainWindow" Height="350" Width="525">
        <local:Class1 CheckFormat="{x:Static local:FCS.FormatDigitsOnly}" />
    </Window>
    
    namespace WpfApplication1
    {
        public delegate bool CheckFormatDelegate(int row, int col, ref string text);
    
        public class Class1
        {
            public virtual CheckFormatDelegate CheckFormat { get; set; }
        }
    
        public class FCS
        {
            private static bool FormatDigitsOnlyImpl(int row, int col, ref string text)
            {
                return true;
            }
    
            public static CheckFormatDelegate FormatDigitsOnly
            {
                get { return FormatDigitsOnlyImpl; }
            }
        }
    }
    

    Edit 2

    I don’t want to steal their answers (so please up-vote them instead, unless you prefer the property work-around), but here is a question that has an even better solution for you:

    Binding of static method/function to Func<T> property in XAML

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

Sidebar

Related Questions

I have this delegate in C#. public delegate string ACSharpDelegate(string message); How would I
let's say I have public delegate DataSet AutoCompleteDelegate( string filter, long rowOffset); can I
I have extended IDictionary like this: public static T ToClass<T>(this IDictionary<string, string> source) where
Does the Java language have delegate features, similar to how C# has support for
When i have delegate like public delegate void PrintMe(); (1) PrintMe a = delegate()
I have this method: private delegate void watcherReader(StreamReader sr); private void watchProc(StreamReader sr) {
Let's say that I have the following delegate: public delegate void Example(); and a
If I have following type hierarchy: abstract class TicketBase { public DateTime PublishedDate {
I have a dictionary which is of type Dictionary [string,handler_func] where handler_func is a
Assuming I have the following delegate public delegate void ControlInitializer(Control control); Is there a

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.