From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-05-2012 02:43 AM
Hello,I want to set the Maximum of Y-axis by using a viewmodel's property. I found a link at
http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/wpfwritablegraphaxescursors/
which used xaml language to set range, but that's not exactly I wanted. Anyone can help me?
11-05-2012 09:55 AM
You can bind the Range
property like any other dependency property; you just need to expose both the minimum and maximum through a Range<TData>
object on your model.
// Model
public Range<double> ModelRange { get { ... } }
// Y-Axis Binding
<AxisDouble Orientation="Vertical" Range="{Binding ModelRange}" ...
11-05-2012 11:53 PM
The AxisDouble
doesn't contain a Source property nor a DataContext property. How can I set the binding? I set the datacontext in NiGraph control and tried to use "Range="{Binding ModelRange}"", but it didn't work.
11-06-2012 09:16 AM
I see what you mean now; appologies for not trying out a full example in the first place. It looks like the graph is not maintaining the logical tree for child components, which is preventing binding using the inherited data context. I have created a task to fix this.
The simplest workaround available is to expose your model as a resource. This will allow you to use Range="{Binding ModelRange, Source={StaticResource ModelResourceKey}}"
to explicitly define the source of the binding.
Here is a full XAML example demonstrating this approach to binding Range
on an axis (and how to initialize DataContext
for other elements):
<Grid>
<Grid.Resources>
<my:Model x:Key="model" />
</Grid.Resources>
<ni:Graph DataContext="{StaticResource model}">
<ni:Graph.Axes>
<ni:AxisDouble Range="{Binding ModelRange, Source={StaticResource model}}" />
</ni:Graph.Axes>
</ni:Graph>
</Grid>
11-15-2012 12:30 AM
Yes, that's a good solution.Thanks.
08-11-2015 10:41 AM
Just wanted to let you know this issue was fixed in the Measurement Studio 2015 release.
05-03-2016 01:52 PM
I have the Range of my AxisDouble binding with my model ok but the RangeCurser.VerticalRange does not.