title: How to create a simple Pie chart using Extended WPF Toolkit
body: <p>I'm fairly new to C# development.
  I'm trying to create a simple Pie chart using Visual Studio, C# and Extended WPF Toolkit. The code that follows is a part of a dll i'm trying to build (plug in for Revit).
  I installed Extended WPF Toolkit using NuGet.
  I was not able to find any tutorial or examples, so i tried to put up the code from some pieces i found on differnt online sources.
  At the moment, i have</p>
  
  <pre><code>xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
  
  &lt;Grid Grid.Row="1"&gt;
          &lt;xctk:Pie x:Name="foobar"
                    DataContext="{Binding PieCollection, UpdateSourceTrigger=PropertyChanged}" &gt;
          &lt;/xctk:Pie&gt;
      &lt;/Grid&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class PiePoint
  {
      public string Name { get; set; }
      public Int16 Share { get; set; }
  }
  
  public class CompareToMultiLODViewModel : INotifyPropertyChanged
  {
  private ObservableCollection&lt;PiePoint&gt; _pieCollection;
  
      public ObservableCollection&lt;PiePoint&gt; PieCollection
      {
          get { return _pieCollection; }
          set { _pieCollection = value; OnPropertyChanged("PieCollection"); }
      }
  public CompareToMultiLODViewModel()
      {
          CompareToMultiLODBtnCommand = new MRCommand(this);
  
          PieCollection = new ObservableCollection&lt;PiePoint&gt;();
          PieCollection.Add(new PiePoint { Name = "Mango", Share = 10 });
          PieCollection.Add(new PiePoint { Name = "Banana", Share = 36 });
      }
  
      private PropertyChangedEventHandler _PropertyChanged;
  
      event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
      {
          add
          {
              //((INotifyPropertyChanged)PieCollection).PropertyChanged += value;
              _PropertyChanged += value;
          }
  
          remove
          {
              //((INotifyPropertyChanged)PieCollection).PropertyChanged -= value;
              _PropertyChanged -= value;
          }
      }
  
      private void OnPropertyChanged(string PropertyName)
      {
          _PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));
      }
  </code></pre>
  
  <p>The code behind xaml is</p>
  
  <pre><code>    public partial class CompareToMultiLOD : Page
  {
      public CompareToMultiLOD()
      {
          InitializeComponent();
  
          DataContext = new CompareToMultiLODViewModel();
      }
  </code></pre>
  
  <p>I do not know if it's relevant, but when debugging i see that DataContext is assigned before the PieCollection is created, and then OnPropertyChanged is triggered once, on PieCollection initialization. PropertyChanged seems to be triggered once (which i do not understand, since i add two values).</p>
  
  <p>I am not sure that ViewModel is the right place to store data that Pie chart uses, but i placed it there temporaly (since it's a mock class, obviously).</p>
  
  <p>At the moment i would just like to make it work.
  Any help is appreciated!</p>