wpf - Calendar grid in WPF application
问题描述
I want to make calendar application with layout like in windows calendar
I wondering what controls can i use to do this layout in wpf application. I was thinking about grid and text blocks in this block but this doesn't work with multiple grid cell. I need my event in calendar can be split with multiple cell in this grid. What can I do to achieve the same layout in WPF?
解决方案
我认为您在Grid
for 布局方面处于正确的轨道。Grid
是高度可定制的,应该支持您对多个单元共享的需求。试试Grid.ColumnSpan
物业。您应该正确设置您的设备ColumnDefinition
才能正确使用它。
查看官方文档中的示例以获取更多详细信息。这也是来自官方网站:
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" ShowGridLines="True" Width="250" Height="100">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock FontSize="20" FontWeight="Bold" Grid.ColumnSpan="3" Grid.Row="0">2005 Products Shipped</TextBlock>
<TextBlock FontSize="12" FontWeight="Bold" Grid.Row="1" Grid.Column="0">Quarter 1</TextBlock>
<TextBlock FontSize="12" FontWeight="Bold" Grid.Row="1" Grid.Column="1">Quarter 2</TextBlock>
<TextBlock FontSize="12" FontWeight="Bold" Grid.Row="1" Grid.Column="2">Quarter 3</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0">50000</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1">100000</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="2">150000</TextBlock>
<TextBlock FontSize="16" FontWeight="Bold" Grid.ColumnSpan="3" Grid.Row="3">Total Units: 300000</TextBlock>
</Grid>
推荐阅读
- sql - 如何为oracle数据库编写多个sql语句一次运行
- python - Python没有名为“编码”的模块
- ios - 如何将不同 AVCompositions 的 AVVideoCompositions 合并为一个
- ios - 如何将 watchOS Swift 目标添加到用 Objective-C 编写的 iOS 应用程序
- list - 为什么循环列表在 Scheme 中不被视为列表?
- arrays - 函数无法在 JSX 列中呈现注释
- c# - 在 SQL 数据库中插入动态列
- unity3d - 如何将 2d 动画导出为 png 文件?
- android - Flutter:getApplicationSupportDirectory 作为同步方法
- actions-on-google - 我们可以用超过 8000 个关于 dialogflow 和 amazon alexa 的问题来制作常见问题解答技能吗?