Hi Kiril,
I tried latest build and looks like template exception issue is solved and I can successfully change the DataContext.
However, I noticed another issue with latest build. When using selection range it is not possible to scroll the SelectionEnd lower then SelectionStart, and SelectionStart upper beyond SelectionEnd. Visually thumbs stay in their place, but property values get corrupted. The rule SelectionStart <= SelectionEnd is not guaranteed anymore.
Please try this sample:
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;
using System.ComponentModel;
namespace WpfApplication2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new Context
{
Start = 2,
End = 5
};
}
}
public class Context : INotifyPropertyChanged
{
private int start, end;
public int Start
{
get
{
return this.start;
}
set
{
this.start = value;
OnPc("Start");
}
}
public int End
{
get
{
return this.end;
}
set
{
this.end = value;
OnPc("End");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPc(string propName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}
}
}
}
Thank you,
Ruben