Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Chart > SeriesDefinition Visibility Binding issue

Answered SeriesDefinition Visibility Binding issue

Feed from this thread
  • Posted on Jan 20, 2010 (permalink)

    BubbleSeriesDefinition supports a property called "Visibility".

    I can set it in XAML to a hard coded value:

                            <chart:BubbleSeriesDefinition BubbleSizeRelative="False" 
                                                          Visibility="Visible" 
                                                          ItemStyle="{StaticResource RadEventBubble}"></chart:BubbleSeriesDefinition> 
                        </chart:SeriesMapping.SeriesDefinition> 

    But when I try setting it to a databound value, Silverlight has a fatal error and the application does not load (it is gettting a XAML parse error on the line with the binding to the Converter:

     
                                                          Visibility="{Binding EventDisplay, Converter={StaticResource Bool2Visible}, Mode=OneWay}" 
                                                          ItemStyle="{StaticResource RadEventBubble}"></chart:BubbleSeriesDefinition> 
                        </chart:SeriesMapping.SeriesDefinition> 

    The probably is NOT in the converter, since I use that same converter in othe examples, and it returns the value Visibility.Collapsed or Visibility.Visible depending on the boolean value.

    I am enclosing the converter, and you can see that it is providing the correct type (SeriesVisibility):
    using System; 
    using System.Windows; 
    using System.Windows.Data; 
    using Telerik.Windows.Controls.Charting; 
     
    namespace BloodHound2 
        /// <summary> 
        /// converts a boolean to a XAML Visibility enum 
        /// </summary> 
        public class Bool2SeriesVisible : IValueConverter 
        { 
            #region public methods 
            /// <summary> 
            /// Conversion from bool to SeriesVisibility 
            /// </summary> 
            /// <param name="value"></param> 
            /// <param name="targetType"></param> 
            /// <param name="parameter"></param> 
            /// <param name="culture"></param> 
            /// <returns></returns> 
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
            { 
                if (value != null && (bool)value) 
                { 
                    return SeriesVisibility.Visible; 
                } 
                else 
                { 
                    return SeriesVisibility.Collapsed; 
                } 
            } 
     
            /// <summary> 
            /// Conversion from Visibilty to bool is not possible. 
            /// </summary> 
            /// <param name="value"></param> 
            /// <param name="targetType"></param> 
            /// <param name="parameter"></param> 
            /// <param name="culture"></param> 
            /// <returns></returns> 
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
            { 
                throw new NotImplementedException(); 
            } 
            #endregion 
        } 




    Reply

  • Giuseppe Giuseppe admin's avatar

    Posted on Jan 22, 2010 (permalink)

    Hi Dr.YSG,

    The SeriesDefinition.Visibility property is not a dependency property so you cannot use a binding expression to assign its value. Note that this cannot be improved at the moment as in Silverlight the binding target can be a DependencyProperty of a FrameworkElement only (not a generic DependencyObject) and the SeriesDefinition is a generic DependencyObject.


    Regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Posted on Jan 22, 2010 (permalink)

    Thank you.

    BTW, I am using SilverLight 4 where any descendent of DependencyObject can be used for a DependencyProperty. Do you have plans to support this in your future releases (I am using your SL4 beta release, but obviously it is not yet supported there).

    It is nice to be able to turn on and off layers (i.e. turn on and off a series) especially when the chart gets busy and one needs to visually contrast information from one series to another.


    Reply

  • Answer Giuseppe Giuseppe admin's avatar

    Posted on Jan 27, 2010 (permalink)

    Hello Dr.YSG,

    Indeed you are right - the advent of Silverlight 4 will loosen the restrictions currently imposed on binding targets and we will certainly look into supporting this in one of the future versions of the control.



    Kind regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Posted on Jul 26, 2011 (permalink)

    edit

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Chart > SeriesDefinition Visibility Binding issue
Related resources for "SeriesDefinition Visibility Binding issue"

Silverlight Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]