我想創建一個只包含一個表,但表不顯示的表,它只是說「System.Windows.Documents.Table」。表用戶控件不顯示
我創建用戶控制,並把一個表中這樣說:
<UserControl x:Class="WpfApplication4.TestTableControl"
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">
<Table>
<Table.Columns>
<TableColumn/>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<!-- Header -->
<TableRowGroup>
<TableRow FontWeight="Bold">
<TableCell>
<Paragraph>Head1</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Head2</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Head3</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>1</Paragraph>
</TableCell>
<TableCell>
<Paragraph>2</Paragraph>
</TableCell>
<TableCell>
<Paragraph>3</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
然後從我的測試項目,我打電話給我的控制是這樣的:
<Window x:Class="WpfApplication4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:WpfApplication4"
Title="MainWindow" Height="350" Width="525">
<my:TestTableControl/>
這裏沒什麼特別的,但是當我構建解決方案時,唯一的r我得到的是這樣的:
我錯過了什麼?
你在.cs文件中有什麼? –
絕對沒有。迄今爲止,它是純xaml。 –