如何将多个孩子添加到边境? [英] how to add multiples children to the border?

查看:78
本文介绍了如何将多个孩子添加到边境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建动态边框,我想添加儿童轿跑车,但它只允许一个子元素

如何添加更多然后一次?



i create dynamic border and i want to add coupe of children to it but it only allow one child element
how to add more then once?

       private void AddItem_Click(object sender, RoutedEventArgs e)
        {

            Canvas piCanv = new Canvas()
            {
                Width = 80,
                Height = 150
                


            };
            Label price = new Label()
            {
                Content = "Price:"
            };
            TextBox priceEdit = new TextBox()
            {
                Width=30
            };
            
            Border rect = new Border()
            {
                Width = 100,
                Height = 200,
                CornerRadius=new CornerRadius(15),
                BorderThickness=new Thickness(5, 10, 15, 20),
                Margin = new Thickness(5, 5, 5, 5),
                BorderBrush = Brushes.SlateBlue,
 // it allow me just one  child
                Child=piCanv, 
// here i want to enter more element how can i do it?
            
            };

            Warp.Children.Add(rect);
        }

推荐答案

border只接受单个孩子。因此,将网格添加为边框子项,然后将任意数量的子项添加到网格
border only accepts single child. So add grid as a border child and then add any number of children to the grid


这篇关于如何将多个孩子添加到边境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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