因此,我正在尝试制作一个简单的消息传递应用程序。我已经有了数据库,类和所有内容。现在,我需要弄清楚如何进行布局。
我想要左侧的按钮,“收件箱”,“已发送的邮件”,“已删除的邮件”等。现在,显然我不想每次按下按钮时都创建一个新窗口。那么,如何保留按钮等,但更改屏幕内容(类似于android活动/片段)呢?
Ans是否可以动态创建所有消息的列表(包含主题,部分内容等),并为每个消息添加单击功能?类似于recyclerview?
我对WPF还是很陌生,所以我真的不知道该怎么做。
我认为TabControl可以非常适合您所需的布局,这是如何使用它的一个示例:
XAML文件
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication2"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TabControl TabStripPlacement="Left">
<TabItem Header="Inbox" Height="30">
<TabItem.LayoutTransform>
<RotateTransform Angle="90" />
</TabItem.LayoutTransform>
<TabItem.Content>
Content of Inbox Window
</TabItem.Content>
</TabItem>
<TabItem Header="Sent Items">
<TabItem.LayoutTransform>
<RotateTransform Angle="90" />
</TabItem.LayoutTransform>
<TabItem.Content>
Content of Sent Items Window
</TabItem.Content>
</TabItem>
<TabItem Header="Deleted Items">
<TabItem.LayoutTransform>
<RotateTransform Angle="90" />
</TabItem.LayoutTransform>
<TabItem.Content>
Content of - guess what - deleted items
</TabItem.Content>
</TabItem>
</TabControl>
</Grid>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句