Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I have the following MarkupExtension:

public class ResourcesExtension : MarkupExtension
{
	private string _key;
	public ResourcesExtension(string key)
	{
		_key = key;
	}

	[ConstructorArgument("key")]
	public string Key
	{
		get { return _key; }
		set { _key = value; }
	}

	public override object ProvideValue(IServiceProvider serviceProvider)
	{
	return	Properties.Resources.ResourceManager.GetObject(_key);
	}
}
and I want to use it in the following XAML:

<ContentControl.Visibility>
	<MultiBinding Converter="{converters:IsTrueConverter}"
	              ConverterParameter="Visible:Collapsed">
		<Binding  Path="OverlaySettings.ShowCurrentDiopterSolution"/>
		<converters.ResourceExtension Key="ShowStatusFlags"/>
	</MultiBinding>
</ContentControl.Visibility>


I am having a hard time figuring out how to use a MarkupExtension in a Binding.

Thanks

What I have tried:

I have tried what you see above
Posted
Comments
Kenneth Haugland 24-May-16 20:46pm    
Maybe this could work:
https://blogs.msdn.microsoft.com/alexdan/2008/10/30/binding-to-a-markupextension-that-returns-a-binding/

Otherwise, just a valueconverter?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900