28

What is local: in XAML, and what parameters in a C# class can be called local: ?

In some code I am looking at, I see xmlns:local="clr-namespace:AskLocal". What does this mean?

Eric Dand
  • 1,106
  • 13
  • 37
yozawiratama
  • 4,209
  • 12
  • 58
  • 106
  • 1
    Is the Wikipedia the official source and definition of "local:" in XAML? Oh, wait; that article is about XML, not XAML. – Sam Hobbs Jul 24 '16 at 08:01

2 Answers2

18

In XAML the local alias is commonly used when referring to the namespace in which the current class is declared. It is not mandatory, it is just commonly done.

Emond
  • 50,210
  • 11
  • 84
  • 115
7

local is an xml namespace. In this case "local" will be the alias for the namespace AskLocal.

It will allow you to declare resources, controls, converters etc from the AskLocal namespace directly in your xaml by using <local:nameofyourcontrol></local:nameofyourcontrol>

Andy Dent
  • 17,578
  • 6
  • 88
  • 115
Filip
  • 656
  • 4
  • 8