07-23-2013 03:46 AM
I am trying to add graphs dynamically in the WPF code behind. This works fine, but I can't find a way to set the default interaction to zoom and the interactions to pan - is it possible to do this in code behind?
Solved! Go to Solution.
07-23-2013 04:45 PM
Yes, you can set both the allowed Interactions
and the DefaultInteraction
on a graph to any valid GraphInteraction
instance. For example:
graph.DefaultInteraction = GraphInteraction.Zoom;
graph.Interactions = new GraphInteractionCollection { GraphInteraction.Pan };
07-25-2013 05:57 AM
Another question regarding code behind and graphs. I am generating plots in my code behind by binding the graph datasource to an observable collection of points[], is there a way to set the label property of each plot when doing this? I would like to do this so i can make the legend display correctly.
07-25-2013 09:38 AM
There is no way to bind the label of an automatically generated plot in the current version of Measurement Studio. To get a custom label in the legend, you will need to add a plot with that label to the Plots
collection on the graph.
07-30-2013 07:45 AM
Ok thats no problem. Is there any way to set the width of a graph (or a legend) to "*" in the code behind?
07-30-2013 10:36 AM
If you mean auto size, using Control Width="Auto"
in XAML is equivalent to setting control.Width = double.NaN
in code. "Auto" is the default value for width and height on all controls.
If you mean star size on a grid containing a graph, using ColumnDefinition Width="*"
in XAML is equivalent to setting columnDefinition.Width = new GridLength(1.0, GridUnitType.Star)
in code.