xaml - Silverlight custom control default xmlns -
in silverlight, possible set default xmlns name of custom control?
by default, each time drag , drop 1 of custom contrl on window, assembly , control automatically added xaml:
... xmlns:my="clr-namespace:myassemblyname;assembly=myassemblyname" ... <my:mycustomcontrol name="whatever"/>
everthing works fine exect replace "my" namespace else (myassemblyname) without editing xaml manually.
you should able control prefix used xmlnsprefixattribute
assembly attribute. place in assemblyinfo.cs found in properties folder of project. while you're @ may add xmlnsdefinitionattribute
de-couple xaml namespace assembly , .net namespace.
[assembly: xmlnsdefinition("http://schemas.yourorganisation.com/controls", "myassemblyname")] [assembly: xmlnsprefix("http://schemas.yourorganisation.com/controls", "myc")]
now when drop control tool bar should get:-
... xmlns:myc="http://schemas.yourorganisation.com/controls" ... <myc:mycustomcontrol name="whatever" />
you can create multiple .net namespaces containing controls , add multiple xmlnsdefinition
entries in assemblyinfo mapping them them same xml namespace , therefore same prefix. can create multiple control library projects mapping same single xml namespace.
Comments
Post a Comment