How to bind data correctly to a ListBox so it would update [C#/WPF/MVVM]
<p>I'm seriously stuck with a trouble updating the bound data in WPF.
Basically, i've got some data in my app, which doesn't update when properties change and i can't fix it.</p>

<p>In my app i'm trying to use the MVVM pattern, so there is a Model with properties X, Y:</p>

<pre><code>public class Сross : INotifyPropertyChanged
{
    private double x;
    private double y;

    public double X
    {
        get { return x; }
        set
        {
            x = value;
            RaisePropertyChanged("X");
        }
    }

    public double Y
    {
        get { return y; }
        set
        {
            y = value;
            RaisePropertyChanged("Y");
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void RaisePropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
</code></pre>

<p>...there is a ViewModel, which contains an ObservableCollection of Crosses:</p>

<pre><code>public class MainWindowViewModel : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    Crosses = new ObservableCollection&lt;Cross&gt;()
    {
        new Cross ()
        {
            X = 300,
            Y = 200
        },
        new Cross ()
        {
            X = 400,
            Y = 300
        }
    };

    private ObservableCollection&lt;Cross&gt; crosses;
    public ObservableCollection&lt;Cross&gt; Crosses
    {
        get
        {
            return crosses;
        }
        set
        {
            crosses = value;
            RaisePropertyChanged("Crosses");
        }
    }

    private void RaisePropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}
</code></pre>

<p>...and there is a View, where there is a ListBox, databound to this ObservableCollection of Crosses.</p>

<pre><code>&lt;Page x:Class="CharMaker.App.MainPageView"&gt;
    &lt;Page.DataContext&gt;
         &lt;local:MainWindowViewModel /&gt;
    &lt;/Page.DataContext&gt;

    ....

    &lt;ListBox&gt;
        &lt;ListBox.ItemsPanel&gt;
            &lt;ItemsPanelTemplate&gt;
                &lt;Canvas IsItemsHost="True" Background="#01FFFFFF" /&gt;
            &lt;/ItemsPanelTemplate&gt;
        &lt;/ListBox.ItemsPanel&gt;

        &lt;ListBox.ItemsSource&gt;
             &lt;Binding Path="Crosses" Mode="TwoWay" /&gt;
        &lt;/ListBox.ItemsSource&gt;

        &lt;ListBox.ItemContainerStyle&gt;
             &lt;Style TargetType="ListBoxItem"&gt;
                  &lt;Setter Property="Canvas.Left" Value="{Binding X, Mode=TwoWay}" /&gt;
                  &lt;Setter Property="Canvas.Top" Value="{Binding Y, Mode=TwoWay}" /&gt;
             &lt;/Style&gt;
         &lt;/ListBox.ItemContainerStyle&gt;
    &lt;/ListBox&gt;
&lt;/Page&gt;
</code></pre>

<p>This code works so that when you move the Cross item (which has a DataTemplate based on Thumb control) in a ListBox field, it's Canvas.Left(or Top) is changing and it updates the X and Y properties of a Cross item, and the other way around.</p>

<pre><code>  &lt;DataTemplate DataType="{x:Type model:Cross}"&gt;
                            &lt;Thumb DragDelta="Thumb_DragDelta"
                           IsEnabled="{Binding IsSelected,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}"&gt;
                                &lt;Thumb.Template&gt;
                                    &lt;ControlTemplate TargetType="Thumb"&gt;
                                        &lt;Canvas Margin="0"&gt;
                                            &lt;Line X1="-5" X2="5" Y1="-5" Y2="5"  Stroke="#FF2E61AB" StrokeThickness="1.5" 
                                             x:Name="FirstLine" /&gt;

                                            &lt;Line X1="-5" X2="5" Y1="5" Y2="-5"  Stroke="#FF2E61AB" StrokeThickness="1.5" 
                                             x:Name="SecondLine" /&gt;
                                        &lt;/Canvas&gt;
                                        &lt;ControlTemplate.Triggers&gt;
                                            &lt;DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" Value="True"&gt;
                                                &lt;Setter TargetName="FirstLine" Property="Stroke" Value="Red"/&gt;
                                                &lt;Setter TargetName="SecondLine" Property="Stroke" Value="Red"/&gt;
                                            &lt;/DataTrigger&gt;
                                        &lt;/ControlTemplate.Triggers&gt;
                                    &lt;/ControlTemplate&gt;
                                &lt;/Thumb.Template&gt;
                            &lt;/Thumb&gt;
                        &lt;/DataTemplate&gt;
</code></pre>

<p>The problem is that after listbox is loaded (and Crosses appear on screen in the appropriate positions), they don't change the X and Y properies in the ViewModel as i move them. And if i change X and Y in ObservableCollection Crosses, they don't move on screen. 
It's worth mentioning, that i did a ListBox with TextBoxes for testing, which is also bound to X, Y properties of Crosses collection:</p>

<pre><code>&lt;ListBox Grid.Row="2" Grid.ColumnSpan="4" ItemsSource="{Binding Crosses}"&gt;
    &lt;ListBox.Resources&gt;
        &lt;DataTemplate DataType="{x:Type model:Cross}"&gt;
            &lt;Grid&gt;
                &lt;Grid.ColumnDefinitions&gt;
                    &lt;ColumnDefinition Width="1*"/&gt;
                    &lt;ColumnDefinition Width="1*"/&gt;
                &lt;/Grid.ColumnDefinitions&gt;

                &lt;TextBox Grid.Column="0" Text="{Binding X, Mode=TwoWay}" /&gt;
                &lt;TextBox Grid.Column="1" Text="{Binding Y, Mode=TwoWay}" /&gt;
             &lt;/Grid&gt;
        &lt;/DataTemplate&gt;
    &lt;/ListBox.Resources&gt;
&lt;/ListBox&gt;
</code></pre>

<p>and the funny thing is that in this ListBox the Data Binding works just fine!
Values are changing in TextBoxes when i move crosses, and crosses move to positions when the value in TextBox is changed.</p>

<p>But in the very same time (if i pause the app) i see that the values in Observable Collection Crosses in ViewModel are same as they were when it was loaded first time.</p>

<p>Please, help me figure out, what the problem is!
Thank you in advance!</p>