This question is locked. New answers and comments are not allowed.
BubbleSeriesDefinition supports a property called "Visibility".
I can set it in XAML to a hard coded value:
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:
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):
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 |
| } |
| } |