Set/Reset a Brush for a PointMark not works

4 posts, 0 answers
  1. Lutz
    Lutz avatar
    5 posts
    Member since:
    Aug 2012

    Posted 30 Aug 2012 Link to this post

    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
  2. Sia
    Admin
    Sia avatar
    667 posts

    Posted 03 Sep 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Lutz
    Lutz avatar
    5 posts
    Member since:
    Aug 2012

    Posted 03 Sep 2012 Link to this post

    Hi,

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

    thank you
  5. Sia
    Admin
    Sia avatar
    667 posts

    Posted 05 Sep 2012 Link to this post

    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.

Back to Top