I need to be able to set point labels as a feature that can be turned on or off by the user. For some reason using my BooleanToVisibilityConverter has no effect on the Textblock that displays my pointdata. I have checked my converter to ensure it is being triggered and getting the right data and it is. I'm using this converter with no issue elsewhere. I added a textblock to display the Visibility property of my PointData Textblock and it always displays the setting 'Visible'. Just for the heck of it I used the same Visibility binding line from my PointData textblock for my chart title and it worked just fine. Does anyone have an idea what the issue is?
<DataTemplate x:Key="CircleMarkerTemplate"> <Grid Background="Transparent"> <Grid.ColumnDefinitions> <ColumnDefinition Width="160"/> <ColumnDefinition Width="24"/> <ColumnDefinition Width="160"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="24"/> <RowDefinition Height="24"/> <RowDefinition Height="24"/> </Grid.RowDefinitions> <Ellipse Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{Binding ActualItemBrush}" Stroke="{Binding Series.ActualMarkerOutline}" StrokeThickness="0.5" Width="{Binding Source={x:Static local:MySettings.Default}, Path=tmMarkerSize}" Height="{Binding Source={x:Static local:MySettings.Default}, Path=tmMarkerSize}"/> <TextBlock x:Name="txblCirclePL" Grid.Row="0" Grid.Column="2" Text="{Binding Item.PointLabel}" Visibility= "{Binding ElementName=ChartControl,Path=DataContext.PointLabelsIsVisible, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/> <TextBlock Grid.Column="0" Grid.Row="2" Text="{Binding ElementName= txblCirclePL, Path=Visibility}"/> </Grid> </DataTemplate>
Thanks for the fast reply Stefan. I've checked and checked and still can not figure out why my binding is not working. So I creating a PointVisible boolean setting in MySettings and used my original PointLabelIsVisible property to set it. So now putting PointVisible in place of the previous property everything works fine. Still would really like to know what I did wrong.
<TextBlock x:Name="txblCirclePL" Grid.Row="0" Grid.Column="2" Text="{Binding Item.PointLabel}" Visibility= "{Binding Source={x:Static local:MySettings.Default}, Path=PointVisible, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/>
Hello,
Thank you for your post. I have been looking into it and I created a sample project for you using the code you have provided and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.