WPF_自动添加行(linq写法)

本文详细介绍了在WPF应用中如何利用LINQ语法动态地为数据网格自动添加行,包括数据绑定和事件处理等关键步骤,帮助开发者提升UI交互体验。
摘要由CSDN通过智能技术生成
 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值