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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:58:38+00:00 2026-06-11T07:58:38+00:00

I am unable to get a custom binding working with a converter, getting this

  • 0

I am unable to get a custom binding working with a converter, getting this when building the project:

Error 2 Unknown property ‘Converter’ for type ‘MS.Internal.Markup.MarkupExtensionParser+UnknownMarkupExtension’ encountered while parsing a Markup Extension.

The error points to this code:

<KeyBinding 
        Key="{helper:KeyboardShortcut InsertTargetToSource, Converter={StaticResource KeyGestureConverterKey},ConverterParameter=Key}" 
        Modifiers="{helper:KeyboardShortcut InsertTargetToSource, Converter={StaticResource KeyGestureConverterKey},ConverterParameter=Modifiers}" 
        Command="{Binding CopyToTargetCommand}"/>

KeyboardShortCut is a binding from a Settings file :

public class KeyboardShortcutExtension : Binding
{
    public KeyboardShortcutExtension()
    {
        Initialize();
    }

    public KeyboardShortcutExtension(string path)
        : base(path)
    {
        Initialize();
    }

    private void Initialize()
    {
        this.Source = TI.Shortcuts.Default;
        this.Mode = BindingMode.TwoWay;
    }

}

And the converter converts from string (like “Ctrl+Shift+X”) to Key and Modifiers:

private KeyGestureConverter mConverter = new KeyGestureConverter();

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        var text = value.ToString();
        var gesture = mConverter.ConvertFromInvariantString(text) as KeyGesture;
        if (parameter == "Key")
        {
            return gesture.Key;
        }
        if (parameter == "Modifiers")
        {
            return gesture.Modifiers;
        }
        return gesture;
    }

Is there something I am missing? Or should I take a different approach when trying to bind from a string in Settings file to a KeyBinding?

EDIT:

Using the following code, everything works fine, but the code is not readable. Is there a way of generating this automatically, so in my markup I would write e.g. just

<MyKeyBinding Value="CopyToTargetCommand"/> 

and it would generate the rest?

<KeyBinding Command="{Binding CopyToTargetCommand}">
        <KeyBinding.Key>
            <helper:KeyboardShortcut Path="InsertTargetToSource" ConverterParameter="Key">
                <helper:KeyboardShortcut.Converter>
                    <StaticResource ResourceKey="KeyGestureConverterKey"/>
                </helper:KeyboardShortcut.Converter>
            </helper:KeyboardShortcut>
        </KeyBinding.Key>
        <KeyBinding.Modifiers>
            <helper:KeyboardShortcut Path="InsertTargetToSource" ConverterParameter="Modifiers">
                <helper:KeyboardShortcut.Converter>
                    <StaticResource ResourceKey="KeyGestureConverterKey"/>
                </helper:KeyboardShortcut.Converter>
            </helper:KeyboardShortcut>
        </KeyBinding.Modifiers>
    </KeyBinding>
  • 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-06-11T07:58:39+00:00Added an answer on June 11, 2026 at 7:58 am
    class CustomizableKeyBinding : KeyBinding
    {
        public CustomizableKeyBinding()
            : base()
        {
        }
    
        StringToKeyGestureConverter converter = new StringToKeyGestureConverter();
    
        public string Description
        {
            set
            {
                InitBindings(value);
            }
        }
    
        private void InitBindings(string value)
        {
            BindingOperations.SetBinding(this, KeyBinding.KeyProperty, new KeyboardShortcutExtension(value) { Converter = converter, ConverterParameter = "Key" });
            BindingOperations.SetBinding(this, KeyBinding.ModifiersProperty, new KeyboardShortcutExtension(value) { Converter = converter, ConverterParameter = "Modifiers" });
        }
    }
    

    Adn then in XAML:

     <helper:CustomizableKeyBinding Command="{Binding CopyToTargetCommand}" Description="..."/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this question earlier, but am still unable to get it working. I
I am unable to get the correct title for this, please change the title
I'm unable to get this jquery statement to work on page load but it
Ive been at this for hours and i am still unable to get jquery
When windows service installer is bombing out with a Error 1001. Unable to get
I'm getting an error with an SDK2.0 app using a rally custom grid: It
I am unable to get jasmine to load my custom javascript file, even though
I am creating a custom AlertDialog with AlertDialog.Builder. However, I am unable to get
I'm unable to get unobtrusive validation to work using custom viewModels representing abstractions of
I get the following error: ERROR/AndroidRuntime(294): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.e/views.L}: java.lang.InstantiationException: com.e.views.L

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.