Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To apply a UWP C# subclass of Grid, follow these steps:

  1. Create a new C# class that inherits from the Grid class:
public class MyGrid : Grid
{
}
  1. Add any additional functionality or properties you want to your subclass:
public class MyGrid : Grid
{
    public string MyTitle { get; set; }

    public MyGrid()
    {
        // Add any additional initialization logic here
    }
}
  1. Use your subclass in your XAML:
<Page xmlns:local="using:MyNamespace">
    <Grid>
        <local:MyGrid MyTitle="My Custom Grid" />
    </Grid>
</Page>
  1. Access the custom properties or methods of your subclass in your C# code:
MyGrid myGrid = new MyGrid();
myGrid.MyTitle = "My Custom Grid";