This is a migrated thread and some comments may be shown as answers.

Set/Reset a Brush for a PointMark not works

3 Answers 42 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Lutz
Top achievements
Rank 1
Lutz asked on 30 Aug 2012, 05:02 PM
Hello Team,

we like to give the user the possibility to select and deselect a PointMark in a LineSeriesDefinition.
Simply in the event ItemClick we change the brush of the .Fill property. But surprisingly, if we set the original brush (= nothing in the example), the view don't change.

This is the relevant code:
Private _manualPointMarkFill As Brush
Private _manualSelectedPointMark As PointMark

Private Sub SetPointMarkSelectedState()
    _manualPointMarkFill = _manualSelectedPointMark.Fill
    _manualSelectedPointMark.Fill = New SolidColorBrush(Colors.Black)
End Sub

Private Sub ClearPointMarkSelectedState()
    If _manualSelectedPointMark IsNot Nothing Then
        'The Color of the PointMark do not reset to white, the PointMark remains black.
        _manualSelectedPointMark.Fill = _manualPointMarkFill

        'That works, but is only correct if the PointMark was white before.
        '_manualSelectedPointMark.Fill = Brushes.White

        _manualSelectedPointMark = Nothing
    End If
End Sub

I have made a little example project (*.Zip), but those files are not allowed to attach??

Do you have an explanation for this behaviour and a functioning idea?
Thank you

3 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 03 Sep 2012, 10:21 AM
Hello Lutz,

Can you please send me the sample project through external resource sharing website?

Thank you in advance,
Sia
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Lutz
Top achievements
Rank 1
answered on 03 Sep 2012, 11:00 AM
Hi,

you can found the example project here:
https://skydrive.live.com/redir?resid=CDCF1D069074D96C!109

thank you
0
Sia
Telerik team
answered on 05 Sep 2012, 11:29 AM
Hi Lutz,

The problem with your code was that you cannot get the pointmark's fill through the _manualSelectedPointMark.Fill property. What you need to do is to get its child of type path and use its fill as follows:
If _manualSelectedPointMark IsNot Nothing Then
  _manualPointMarkFill = _manualSelectedPointMark.ChildrenOfType(Of System.Windows.Shapes.Path)().FirstOrDefault().Fill
  _manualSelectedPointMark.Fill = New SolidColorBrush(Colors.Black)
End If

I hope that this helps.

Kind regards,
Sia
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Lutz
Top achievements
Rank 1
Answers by
Sia
Telerik team
Lutz
Top achievements
Rank 1
Share this question
or