【发布时间】:2011-04-01 00:04:21
【问题描述】:
您好,我有一个这样的 xaml 代码
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="test.Window1"
x:Name="Window"
Title="Window1"
Width="640" Height="480">
<Grid x:Name="LayoutRoot">
<Button Content="Create a tab" HorizontalAlignment="Left" Margin="49,26,0,0" VerticalAlignment="Top" Width="75"/>
<TabControl Margin="0,63,0,0">
</TabControl>
</Grid>
</Window>
在 TabControl 中没有 tabItem。 请帮助我,如何使用 c# 编程: 如果我单击该按钮,它将在其中添加一个带有网格的选项卡项和一个文本块。我希望的结果是这样的:
<Grid x:Name="LayoutRoot">
<Button Content="Create a tab" HorizontalAlignment="Left" Margin="49,26,0,0" VerticalAlignment="Top" Width="75"/>
<TabControl Margin="0,63,0,0">
<TabItem Header="tab1">
<Grid>
<TextBlock Text="hi there" />
</Grid>
</TabItem>
</TabControl>
</Grid>
如果我单击更多该按钮,将继续添加这样的选项卡。
请帮助我(崇拜)
【问题讨论】:
标签: c# wpf tabcontrol