Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?

C#
       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);
        }
Posted

1 solution

border only accepts single child. So add grid as a border child and then add any number of children to the grid
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900