Reputation: 9617
public void CreateALine()
{
// Create a Line
Line redLine = new Line();
redLine.X1 = 50;
redLine.Y1 = 50;
redLine.X2 = 200;
redLine.Y2 = 200;
// Create a red Brush
SolidColorBrush redBrush = new SolidColorBrush();
redBrush.Color = Colors.Red;
// Set Line's width and color
redLine.StrokeThickness = 4;
redLine.Stroke = redBrush;
// Add line to the Grid.
LayoutRoot.Children.Add(redLine);
}
I have code from here I need to draw line. But there is some object LayoutRoot in tutorial which is not definedin my code what should i do?
Upvotes: 0
Views: 994
Reputation: 81233
It signifies a panel name
in your XAML file. It can be grid or any other panel type
.
<Window>
<Grid x:Name="LayoutRoot">
....
</Grid>
</Window>
Upvotes: 2