最初我只有一个带有按钮,复选框和文本框的纯网格控件。我希望在我的应用程序中实现一个选项卡控件,我添加了一个选项卡控件并为这些子项添加了一个堆栈面板。我在输出中看到的只不过是空白。请指教我...谢谢!
原始代码示例:
<Grid Width="1185" Height="945" Background="Snow">
<Button Height="23" HorizontalAlignment="Right" Margin="0,133,56,0" Name="commonssnamemodifyButton" VerticalAlignment="Top" Visibility="Hidden" Width="67" Click="commonssnamemodifyButton_Click">Modify</Button>
<Button Height="23" HorizontalAlignment="Right" Margin="0,72,56,0" Name="mobilessnamemodifyButton" VerticalAlignment="Top" Width="67" Visibility="Hidden" Click="mobilessnamemodifyButton_Click">Modify</Button>
<Label Margin="588,205,497,0" Name="resultLabel" Visibility="Hidden" Height="23" VerticalAlignment="Top"></Label>
</Grid>
修改后的代码:
<Grid Width="1185" Height="945" Background="Snow">
<TabControl Margin=" 5">
<TabItem Header="Properties">
<StackPanel>
<Button Height="23" HorizontalAlignment="Right" Margin="0,133,56,0" Name="commonssnamemodifyButton" VerticalAlignment="Top" Visibility="Hidden" Width="67" Click="commonssnamemodifyButton_Click">Modify</Button>
<Button Height="23" HorizontalAlignment="Right" Margin="0,72,56,0" Name="mobilessnamemodifyButton" VerticalAlignment="Top" Width="67" Visibility="Hidden" Click="mobilessnamemodifyButton_Click">Modify</Button>
<Label Margin="588,205,497,0" Name="resultLabel" Visibility="Hidden" Height="23" VerticalAlignment="Top"></Label>
</StackPanel>
</TabItem>
<TabItem Header ="Output">
</TabItem>
</TabControl>
</Grid>
答案 0 :(得分:0)
哦,我试过了,我在TabItem下放置了网格控件,类似这样,它起作用了:
<TabControl Margin=" 5">
<TabItem Header="Properties">
<Grid Width="1185" Height="945" Background="Snow">
<Button Height="23" HorizontalAlignment="Right" Margin="0,133,56,0" Name="commonssnamemodifyButton" VerticalAlignment="Top" Visibility="Hidden" Width="67" Click="commonssnamemodifyButton_Click">Modify</Button>
<Button Height="23" HorizontalAlignment="Right" Margin="0,72,56,0" Name="mobilessnamemodifyButton" VerticalAlignment="Top" Width="67" Visibility="Hidden" Click="mobilessnamemodifyButton_Click">Modify</Button>
<Label Margin="588,205,497,0" Name="resultLabel" Visibility="Hidden" Height="23" VerticalAlignment="Top"></Label>
</Grid>
</TabItem>
<TabItem Header ="Output">
</TabItem>
</TabControl>