【发布时间】:2015-01-07 22:45:39
【问题描述】:
我继承了Button 并尝试将其添加到我的主窗口中。
它不会出现在Toolbox 中。我已经尝试重建好几次了。
我已尝试将xmlns:dc="clr-namespace:123Letters 和xmlns:dc="clr-namespace:123Letters;assembly=123Letters 添加到我的MainWindow。
我的MainWindow 是:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="MainWin"
Title="123 Letters">
</Window>
我的WeatherStationButton 是:
<Button x:Class="WeatherStationButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</Button>
和
Public Class WeatherStationButton
Inherits Button
Public Property WeatherStation As tblWeather
End Class
这是超级简单的东西。我相信这是因为 XAML 不允许在命名空间的第一部分中使用数字,但我找不到任何对 anywhere 的引用,所以我问我是否做错了什么或者这是其中之一XAML 的“特性”?
【问题讨论】:
-
我是对的。 XAML 对以数字开头的命名空间进行了秘密魔法。您必须在第一个数字前添加下划线,例如:
_123Letters。除了反复试验之外,我没有其他参考资料。
标签: wpf vb.net xaml namespaces