c# - Access namespace not defined exactly in XAML -
lets assume xaml defined below imported namespace in mycontrols.
<grid x:class="layoutgrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:system;assembly=mscorlib" xmlns:mycontrols="clr-namespace:predefined.controls;assembly=uicontrols" >
if use defined in namespace predefined.controls
reference alias mycontrols
example:
<mycontrols:mycustombutton name="submitbutton" />
now if namespace predefined.controls.customtextboxes
existed, there way use control inside namespace without having add xaml definition @ top?
something this??
<mycontrols.customtextboxes:mycustomtextbox name="textbox1" />
no. in xml, namespace prefix defines namespace, can't tack things onto it. you'll need add full clr namespace xml namespace declaration in parent element:
xmlns:ctb="clr-namespace:predefined.controls.customtextboxes;assembly=uicontrols"
and use prefix in when instantiate element/control in xaml:
<ctb:mycustomtextbox />
Comments
Post a Comment