Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
645
Change current Marker
posted

I'm using the XamDataChart to show some ScatterSeries data and would like to graphically indicate that the marker in a series is selected.  Essentially, if the user clicks on the marker (or otherwise selects it), I'd like to do something to either resize or color (maybe both) that marker while it is the selected data point.

I've tried something like so to change the fill color and it works:

 

xamDataChart1_seriesMouseLeftButtonUp(object sender, DataChartMouseButtonEventArgs e)

{

    Shape shape = e.OriginalSource as Shape;

    //  

    Color color = new Color();

    color = Color.FromArgb(255,255,0,0);

    shape.Fill = new SolidColorBrush(color);

}

 

And that will change the shape fill for the marker I click on to red.  But what about resizing the shape to maybe twice as big?  How can I do that?

Thanks,

Matt

Parents
  • 645
    Verified Answer
    posted

    I ended up doing something like so:

    Shape shape = e.OriginalSource as Shape;

    shape.RenderTransform = new ScaleTransform(2.0,2.0, shape.RenderSize.Height/2.0, shape.RenderSize.Width/2.0);

    And this will blow the marker up to twice its size centered properly.

    When I want to undo the scaling, I applied another ScaleTransform to it, something like this:

    shape.RenderTransform = new ScaleTransform(1.0, 1.0, shape.RenderSize.Height/2.0, shape.RenderSize.Width/2.0);

    Seems to work well enough.

    If you have other thoughts, I'd be interested in hearing them.

    Regards,

    Matt

Reply Children