我想做如下的事情,但我收到一个错误,“来自 XAML 命名空间的属性 'Class' 仅在根元素上被接受。” 好吧,我想我的问题是如何抽象出一个 Window 类(在这种情况下,问题在于下面的 SomeOtherWindowClass)(因为我已将此类作为 WPF 窗口添加到我的项目中),并将其作为子类包含在内我项目中的窗口?
<Window x:Class="myLogViewer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="myLogViewer"
Height="600"
Width="800"
Background="Black"
BorderBrush="Black"
Style="{DynamicResource MainWindow}"
WindowStyle="None">
<Grid Background="Black">
<Window x:Name="myOtherLogViewerWindow"
x:Class="myLogViewer.SomeOtherWindowClass"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="Black"
BorderBrush="Black"
Style="{DynamicResource myOtherLogViewerWindow}"
WindowStyle="None"/>
</Grid>
</Window>