I am trying to two-way bind XamZoombar.Range to a property in a view model. I have tried it a number of different ways. But none of them work. Binding Range directly to a property of type Infragistics.Controls.Range in the view model throws a XAML parsing (null object reference) exception.
Two-way binding the individual dependency properties Minimum/Maximum has very odd behavior. Both the getters get called but only the Maximum value is ever actually used. Neither of the setters are ever called when I move the thumbs of the zoombar.
Between the two, I prefer to bind the Minimum/Maximum properties individually, but at this point I will take anything.
Attached is a very bare-bones example project that demonstrates what I am seeing. In the commented out code in the XAML you will see some of the other things I have tried that also didn't work.
From what I can tell this looks like a bug in XamZoombar.
Has anyone looked at this? This is really limiting my ability to use this control. Is anyone else having this problem?
Hello,
The following snippet in your sample
<ig:XamZoombar Range="{Binding Path=MyRange, Mode=TwoWay}">
will work.
The null exception is a bug in the Zoombar. It is now fixed and it should be available with the next service release.
The next service relese will be in the middle of May - download link.
Thank you!
I just installed 10.3.20103.2192 and it still throws the null reference exception. Can you confirm that this is fixed? This is holding me up. I could really use this fix.
Could you check if your project references the dll's from the Service Release.
I downloaded your sample project and referenced it to the 10.3.20103.2192 assemblies. In MainPage.xaml I uncommented line 22 and commented lines 24, 25 and 26.
Here is the modified content of MainPage.xaml:
<UserControl x:Class="XamZoombarTest.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:local="clr-namespace:XamZoombarTest" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid> <Grid.Resources> <!--<local:ViewModelToRangeConverter x:Key="ViewModelToRangeConverter" /> <ig:Range x:Key="range" Minimum="{Binding Path=MyMinimum, Mode=TwoWay}" Maximum="{Binding Path=MyMaximum, Mode=TwoWay}" />--> </Grid.Resources> <ig:XamZoombar x:Name="Zoombar" Minimum="0" Maximum="100" SmallChange="10" LargeChange="20" Width="400" Height="100" Range="{Binding Path=MyRange, Mode=TwoWay}"> <!--Range="{StaticResource range}">--> <!--<ig:XamZoombar.Range> <ig:Range Minimum="{Binding Path=MyMinimum, Mode=TwoWay}" Maximum="{Binding Path=MyMaximum, Mode=TwoWay}" /> </ig:XamZoombar.Range>--> <ig:XamZoombar.HorizontalPreviewContent> <ig:XamLinearGauge> <ig:XamLinearGauge.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1" > <GradientStop Color="Red" Offset="0"></GradientStop> <GradientStop Color="Blue" Offset="1"></GradientStop> </LinearGradientBrush> </ig:XamLinearGauge.Background> <ig:XamLinearGauge.Scales> <ig:LinearGaugeScale StartValue="0" EndValue="100"> <ig:LinearGaugeScale.LabelGroups> <ig:LinearGaugeLabelGroup /> </ig:LinearGaugeScale.LabelGroups> </ig:LinearGaugeScale> </ig:XamLinearGauge.Scales> </ig:XamLinearGauge> </ig:XamZoombar.HorizontalPreviewContent> </ig:XamZoombar> </Grid> </UserControl>
When I run the project, the binding works.
I have attached the modified project:
Could you run the project and see if it works for you.
Thanks!
My mistake. It is fixed. I was getting the same error as before (same line number) but it was being caused by something else. Silverlight runtime errors aren't very specific. Sorry about that.