I am an absolute newbie to c#, WPF and MVVM and I and trying to create a canvas were I can add points based on an observable list's points x and y coordinates. I created the custome user control and this is my view model:
public class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public ViewModel()
{
points = new ObservableCollection<Point>();
this.testData();
}
public ObservableCollection<Point> points { get; set; }
private void testData()
{
// points.Add(new Point(0, 50) );
//points.Add(new Point(50, 0));
//points.Add(new Point(13, 73));
//points.Add(new Point(12, 23));
//points.Add(new Point(34, 80));
//points.Add(new Point(322, 225));
//points.Add(new Point(270, 510));
points.Add(new Point(0, 0));
}
}
This is what I have on my mainWindows.xaml
<Canvas>
<local:UserControl2 />
</Canvas>
your clarification is much appriciated