堆栈面板和网格

发布于 2024-10-18 08:28:00 字数 1805 浏览 0 评论 0原文

最初我只有一个带有按钮、复选框和文本框的纯网格控件。我希望在我的应用程序中实现一个选项卡控件,我添加了一个选项卡控件并为子项添加了一个堆栈面板。我在输出中看到的只是空白。请给我建议..谢谢!

原始代码示例:

<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>

originally i have just a pure grid control with buttons, checkboxes and textboxes. I wish to implement a tab control in my application, i added a tab control and added a stack panel for the children. What i see at the output is nothing but blank. Please advice me.. thanks!

example of original code:

<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>

modified code:

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨洒年华 2024-10-25 08:28:00

哦,我尝试了,我将网格控件放在 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>

Oh i tried it, i placed grid control under TabItem, something like this and it worked:

   <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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文