I'm trying to bind to a CollectionViewSource nested property (CVS.View.Groups.Count) and it doesn't seem to work in code :
Binding binding = new Binding();
binding.Path = new PropertyPath("View.Groups.Count");
binding.Mode = BindingMode.OneWay;
binding.Source = CVS;
BindingOperations.SetBinding(this, ValueProperty, binding);
But it's working well in WPF/xaml.
<DataTrigger Binding="{Binding Path=CVS.View.Groups.Count, Mode=OneWay}" Value="1">
So I'm wondering what is the difference between these both approach and what is wrong in code way binding. Meanwhile this kind of code is working well on no-nested property when it's a simple dependency property in a dependency object, so I suppose there is a problem with provided PropertyPath..
Any help would be appreciated.