My first WPF application, but it is not working. Help please!
xaml:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="308" Width="527">
<Grid Name="canvas">
<Canvas></Canvas>
</Grid>
</Window>
Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
Line line = new Line();
line.X1 = 0;
line.Y1 = 100;
line.X2 = 0;
line.Y2 = 100;
line.Stroke = Brushes.Red;
line.StrokeThickness = 1; // Note1
canvas.Children.Insert(0, line);
}
}
}