locked
Add grid inside frame from Code RRS feed

  • Question

  • User388804 posted

    I want to display data which is a combination of labels,images,grid inside a frame.

    How to create a grid inside frame from code behind? c#

    Wednesday, February 26, 2020 4:51 AM

Answers

  • User382358 posted
            Frame frame = new Frame();
            Grid MainGrid = new Grid();
    
            RowDefinition rowDefinition = new RowDefinition();
            ColumnDefinition columnDefinition = new ColumnDefinition();
    
            columnDefinition.Width = new GridLength(1, GridUnitType.Star);
            rowDefinition.Height = new GridLength(1, GridUnitType.Auto);
    
            MainGrid.ColumnDefinitions.Add(columnDefinition);
            MainGrid.RowDefinitions.Add(rowDefinition);
    
            Label lbl = new Label();
            lbl.Text = "Lable";
    
            MainGrid.Children.Add(lbl, 0, 0);
    
            frame.Content = MainGrid;
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, February 26, 2020 6:01 AM