WPF_自动添加行(linq写法)
作者
本次任务完成时间:
开发工具与关键技术:
完成模块功能:功能实现
这里使用了最基本的方法来实现自动添加行,最外使用Grid布局,放一些参数,根据
自己需要RowDefinitions多少,ColumnDefinitions多少布局,我这里根据所需把页面分成Row:8行,column:行,把所需要添加的行布局好,在把它先隐藏。在后台通过点击按钮显示出来。
、页面布局:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="8"/>
<RowDefinition/>
RowDefinition Height="30"/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="8"/>
<RowDefinition/>
<RowDefinition Height="8"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition/>
<ColumnDefinition Width="20"/>
<ColumnDefinition />
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Button Grid.Row="2" Grid.Column="8" Width="30" Content="+" x:Name="btn_Add" HorizontalAlignment="Right" Margin="0,0,40,0" Click="Btn_Add_Click"/>
<Button Grid.Row="2" Grid.Column="8" Width="30" Content="-" x:Name="btn_Subtract" HorizontalAlignment="Right" Margin="40,0,0,0" Click="Btn_Subtract_Click"/>
<TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Text="航空公司:中国南方航空公司" HorizontalAlignment="Left" FontSize="18" Foreground="DimGray"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="从 城市:" Horizon![在这里插入图片描述](https://img-blog.csdnimg.cn/20200916152729152.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDU
WPF_自动添加行(linq写法)
最新推荐文章于 2024-06-22 20:54:50 发布
本文详细介绍了在WPF应用中如何利用LINQ语法动态地为数据网格自动添加行,包括数据绑定和事件处理等关键步骤,帮助开发者提升UI交互体验。
摘要由CSDN通过智能技术生成