Monday 15 March 2010

c# - Namespace path in WPF XAML -



c# - Namespace path in WPF XAML -

i have content directory in main solution. in content catalog have 2 catalogs: viewmodels , views

in xaml, have declared:

xmlns:vm ="clr-namespace:appname.content"

now, want reference class in viewmodel catalog:

<datatemplate datatype="{x:type vm:laserpathviewmodel}">

i know thats wrong because namespace of laserpathviewmodel appname.content.viewmodels.

but how reference without add together next 1 namespace declaration?

you don't. have declare other namespace. 1 way adding namespace declaration:

xmlns:vm2 ="clr-namespace:appname.content.viewmodel"

and can utilize this:

<datatemplate datatype="{x:type vm2:laserpathviewmodel}">

but there way declare namespaces. can utilize xmlnsattribute allows map multiple .net namespaces 1 x(a)ml namespace. can find nice explanation here.

c# wpf xaml

No comments:

Post a Comment