C#WPF点击不同按钮下方如何显示不同的内容 10
2个回答
展开全部
可以用TabItem,也可以用用户控件实现,点击按钮下方切换显示不同页面,例:
xmal:
<Border BorderThickness="1" BorderBrush="#FF37474B" CornerRadius="3,3,0,0">
<DockPanel Height="40" VerticalAlignment="Top" Background="#FF37474B">
<!--style是我自己写的样式,你可以自己写-->
<Button x:Name="paidan" Style="{StaticResource BtnStyle}" Content="按钮1" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,10,0,0" Click="tcbi_order_Clicked"/>
<Button x:Name="fahuo" Style="{StaticResource BtnStyle}" Content="按钮2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,10,0,0" Click="deliverGoods_order_Clicked"/>
</DockPanel>
</Border>
<DockPanel Margin="0,40,0,0">
<!--这里面就是你要交换的页面显示-->
<ContentControl Name="Change_Page"/>
</DockPanel>
后台:
按钮事件:
Change_Page.Content = new Frame()
{
Content = new 页面名称()
};
xmal:
<Border BorderThickness="1" BorderBrush="#FF37474B" CornerRadius="3,3,0,0">
<DockPanel Height="40" VerticalAlignment="Top" Background="#FF37474B">
<!--style是我自己写的样式,你可以自己写-->
<Button x:Name="paidan" Style="{StaticResource BtnStyle}" Content="按钮1" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,10,0,0" Click="tcbi_order_Clicked"/>
<Button x:Name="fahuo" Style="{StaticResource BtnStyle}" Content="按钮2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,10,0,0" Click="deliverGoods_order_Clicked"/>
</DockPanel>
</Border>
<DockPanel Margin="0,40,0,0">
<!--这里面就是你要交换的页面显示-->
<ContentControl Name="Change_Page"/>
</DockPanel>
后台:
按钮事件:
Change_Page.Content = new Frame()
{
Content = new 页面名称()
};
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询