QualitativeRange Error on Binding

5 posts, 0 answers
  1. Ralf
    Ralf avatar
    10 posts
    Member since:
    Nov 2010

    Posted 25 Jan 2011 Link to this post


    in my scenario i try to visualize the variance of a production cyle within a radgridview. For this i want to show a warning/error range.

    <telerik:RadHorizontalBulletGraph Width="150" Height="20"
                                      FeaturedMeasure="{Binding Input0TimeLast}"
                                      ComparativeMeasure="{Binding Auftrag.ZyklusIstSoll}">
            <telerik:QualitativeRange Brush="Red" Value="{Binding ZyklusErrorBound}" />
            <telerik:QualitativeRange Brush="Yellow" Value="{Binding ZyklusWarningBound}" />
            <telerik:QualitativeRange Brush="Green" Value="{Binding ZyklusOkBound" />

    public int ZyklusErrorBound
            var x = this.Auftrag.ZyklusIstSoll - this.Auftrag.ZyklusIstToleranz;
            return x;
    public int ZyklusWarningBound
            var x = this.Auftrag.ZyklusIstSoll - (this.Auftrag.ZyklusIstToleranz / 2);
            return x;

    When i bind the three QualitativeRange`s i get a exception "Sequence contains no elements". If i set instead of ZyklusOkBound a fixed value for example, no exceptions is thrown. But the two other values are not called from my Itemssource (i´ve checked that by setting a breakpoint on my getters). Instead of a message shows up in my console:

    System.Windows.Data Error: 2 : Cannot find govening FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=ZyklusWarningBound; DataItem=null; target element is 'QualitativeRange' (HashCode=7579691); target property is 'Value' (type 'Double')
    System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=ZyklusErrorBound; DataItem=null; target element is 'QualitativeRange' (HashCode=7579691); target property is 'Value' (type 'Double')

    What is absolutely remarkable, if i bind ZyklusErrorBound or ZyklusWarningBound to FeaturedMeasure the value is retrieved..

    Thanks in advance for your help.
  2. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 28 Jan 2011 Link to this post

    Hello Ralf,

    Check this xbap example here (BulletGraph -> FirstLook) -- you can bind the qualitative ranges like this:

    <telerik:RadGridView Name="RadGridVeiw1" telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True" AutoGenerateColumns="False" IsReadOnly="True" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False" ItemsSource="{Binding Data}">
            <telerik:GridViewDataColumn Header="% of YTD target" IsFilterable="False">
                        <StackPanel Orientation="Horizontal" Height="20">
                            <Grid Width="45">
                                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding PercentYTDTargetText}" />
                            <telerik:RadHorizontalBulletGraph Width="150" Maximum="2"
                                                              FeaturedMeasure="{Binding PercentYTDTarget}"
                                                              QualitativeRanges="{Binding Ranges}" />

  3. Ralf
    Ralf avatar
    10 posts
    Member since:
    Nov 2010

    Posted 31 Jan 2011 Link to this post

    Hi Bart,

    thank you for your answer. I had already taken a look to BulletGraph/FirstLook example.
    In this a collection is created code behind. But in this case i use the MVVM pattern and
    i don`t want to use references (for QualitativeRangeCollection) to my controls in the model view.

    In the BulletGraph/Configurator example you can see that there is a other approach and i assume
    that there binding should be possible.

    <telerik:RadVerticalBulletGraph Grid.Column="0"
        FeaturedMeasure="{Binding Value,ElementName=FeaturedSlider}"
        ComparativeMeasure="{Binding Value,ElementName=ComparativeSlider}"
        ProjectedValue ="{Binding Value,ElementName=ProjectedSlider}"
                <telerik:QualitativeRange Value="50" />
                <telerik:QualitativeRange Value="70" />
                <telerik:QualitativeRange />


  4. Ralf
    Ralf avatar
    10 posts
    Member since:
    Nov 2010

    Posted 01 Feb 2011 Link to this post

    Hello all,

    i found a solution after i realized that a direct binding of values seems not to be possible. Instead of that i use a MutlivalueConverter to return a QualitativeRangeCollection. Works like a charm.

        <MultiBinding Converter="{StaticResource ZyklusBoundsConverter}">                                           
            <Binding Path="Auftrag.ZyklusErrorBound" />
            <Binding Path="Auftrag.ZyklusWarningBound" />
            <Binding Path="Auftrag.ZyklusOkBound" />

    public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        QualitativeRangeCollection qr = new QualitativeRangeCollection();
        var x1 = new QualitativeRange();
        x1.Brush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
        x1.Value = System.Convert.ToDouble(values[0]);           
        var x2 = new QualitativeRange();
        x2.Brush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Yellow);
        x2.Value = System.Convert.ToDouble(values[1]);           
        var x3 = new QualitativeRange();
        x3.Brush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
        x3.Value = System.Convert.ToDouble(values[2]);           
        return qr;

  5. Yavor
    Yavor avatar
    401 posts

    Posted 02 Feb 2011 Link to this post

    Hello Ralf,

    Another approach could be to use binding with Source that overrides the value inherited by the DataContext. You can find more information in this topic in our forum.

    Hope you find this helpful!

    Yavor Ivanov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top