I have a RadGridView, a RadDataPager and a RadNumericUpDown all defined in code.
Now i want to bind the RadDataPager.PageSize to the RadNumericUpDown.Value so the pagesize of the pager is changeable via the RadNumericUpDown control.
Thus i try:
RadDataPager dataPager = new ...;
RadNumericUpDown pageSizeSelector = new ...;
Binding b = new Binding();
b.Mode = BindingMode.TwoWay;
b.Source = pageSizeSelector.Value;
pageSizeSelector.SetBinding(dataPager.PageSize, b);
But this generates an error about the dataPager.PageSize
not being a DependencyProperty
. What i'm a missing?
EDIT
Thanks to Klinger i got it straight. SetBinding
wants the Static Definition of the DP, not a reference to the instance.
Binding b = new Binding("PageSize");
b.Mode = BindingMode.TwoWay;
b.Source = dataPager;
pageSizeSelector.SetBinding(RadNumericUpDown.ValueProperty, b);