【发布时间】:2016-11-22 05:57:41
【问题描述】:
假设我的 XAML 在 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"
>
如果我要使用命名空间 Predefined.Controls 中定义的东西,那么我会简单地用它的别名 mycontrols 来引用它
例子:
<mycontrols:MyCustomButton Name="SubmitButton" />
现在如果命名空间Predefined.Controls.CustomTextBoxes 也存在,有没有办法在这个命名空间内使用控件而不必将它添加到顶部的 XAML 定义中?
这样的??
<mycontrols.CustomTextBoxes:MyCustomTextBox Name="TextBox1" />
【问题讨论】:
标签: c# .net wpf xaml namespaces