How to use namespaces in XAML WPF including to refer to a converter (maybe other code too)

Place in header part of file. My initial mistake was
    xmlns:local="clr-namespace:MyConverters
Should have been
    xmlns:local="clr-namespace:OneWay.WPF.MyConverters
Need to include the assembly, even if it is the same project.
In this code local gives the namespace a short name.

Next using the namespace in XAML

<Style.Resources>
    <local:ButtonCenterConverter x:Key=”DivideByTwo”></local:ButtonCenterConverter>
</Style.Resources>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: