06-03-2016 05:02 PM
I just migrated my VS2013 project from Measurement Studio 2012 to Measurement Studio 2015 and udpated all the references. I am getting the following error in my XAML
Type reference cannot find type named '{http://schemas.ni.com/controls/2009/xaml/presentation/primitives}NumericControlCommands'.
Solved! Go to Solution.
06-06-2016 12:05 PM - edited 06-06-2016 12:10 PM
I have confirmed that the NumericControlCommands class is indeed missing from the NationInstruments.Controls.Numerics.dll for version 15.0.45.3898. It can be found on older versions (e.g. 13.0.45.242) under the NationalInstruments.Controls.Primitives.
My MVVM project is currently broken because I need to bind to the DecrementCommand and IncrementCommand methods in this class. Has this class been moved to another assembly? Is there some other means to achieve increment and decrement bindings using another class?
06-06-2016 03:04 PM
Hello,
The DecrementCommand Property still does exeist, but in the ControlCommands Class instead of the NumericControlCommands Class in Measurement Studio 2015. Does that work with your code?
06-06-2016 03:53 PM
I have updated all my xaml view code to refer to the "ControlCommands.DecrementCommand" and "ControlCommands.IncrementCommand", however I am receiving a new exception. These commands were linked to the spinner elements of the numeric control, but now I am receiving errors that it cannot locate resource 'primitives/spinner.xaml', Was that element also removed from the libary? Here is the example xaml code:
xmlns:niPrimitives="http://schemas.ni.com/controls/2009/xaml/presentation/primitives"
.
.
.
<niPrimitives:Spinner.Style>
<Style TargetType="{x:Type niPrimitives:Spinner}">
<Setter Property="AspectRatio" Value="0.682"/>
<Setter Property="DecreaseCommand" Value="niPrimitives:ControlCommands.DecrementCommand"/>
<Setter Property="DecreaseContent" Value="M 1,1.25 L 3,1.25 2,2.75 z M 0,0 4,4"/>
<Setter Property="IncreaseCommand" Value="niPrimitives:ControlCommands.IncrementCommand"/>
<Setter Property="IncreaseContent" Value="M 1,2.75 L 3,2.75 2,1.25 z M 0,0 4,4"/>
<Setter Property="ButtonStyle">
<Setter.Value>
<Style TargetType="{x:Type RepeatButton}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
<ThemesAero:ButtonChrome x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" RenderDefaulted="{TemplateBinding Button.IsDefaulted}" SnapsToDevicePixels="True">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ThemesAero:ButtonChrome>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="RenderDefaulted" TargetName="Chrome" Value="True"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="RenderPressed" TargetName="Chrome" Value="True"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#FFADADAD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Path Data="{Binding}" Fill="Black" Stretch="Fill"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</niPrimitives:Spinner.Style>
06-08-2016 03:22 PM
It turns out this was an in-direct exception related to a few of my files that I still needed to change from "NumericControlCommands" to "ControlCommands". The project seems to be working properly now.
Thanks