如何更改网格中的行定义? [英] How to change the Row Definition in grid?

查看:63
本文介绍了如何更改网格中的行定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Maingrid开始-----

它有一些列定义

< grid> --- childgrid

它有一些行定义

内部我想将第二行控件(文本块)更改为第一行

childgrid结束

Maingrid结束

有没有办法做这个?有什么建议吗?

Hi Maingrid starts-----
it has some column definitions
<grid>---childgrid
it has some row definitions
Inside i want to change the second row control(textblock) to first row
childgrid ends
Maingrid Ends
Is there any way to do this?Any suggestions?

推荐答案

<grid>
           <grid.columndefinitions>
               <columndefinition width="250" />
               <columndefinition width="*" />
               <columndefinition width="Auto" />
           </grid.columndefinitions>
           <grid>
               <grid.rowdefinitions>
                   <rowdefinition height="150" />
                   <rowdefinition height="*" />
                   <rowdefinition height="Auto" />
               </grid.rowdefinitions>
               <textblock x:name="tb" grid.row="0" text="Hello" height="50" xmlns:x="#unknown"></textblock>
               <textblock x:name="tb2" grid.row="2" text="Hello2" height="50" xmlns:x="#unknown"></textblock>
           </grid>
       </grid>
       <Button Content="change" Click="Button_Click"/>




private void Button_Click(object sender, RoutedEventArgs e)
     {
        // string s = "Hello";
         Grid.SetRow(tb, 1);
     }


这篇关于如何更改网格中的行定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆