I a trying to create an interface that implements a Measurement Studio 2013 graph in Visual Studio 2015.
I have successfully added the graph to the form and tested it for about a week, but now I'm trying to add a custom pull out menu to the same form. If I comment out the graph, the project builds and runs as intended. If I disable the events that fire the pull out menu and add the graph back in, the program runs as intended, But if the two are on the form at the same time, I get a XAML Parse error on my last closing .
If I investigate the inner exceptions, I arrive at a NationalInstruments.Control 'Specified Method is not Supported' error.
narrowing it down further, if I removed the event trigger's SourceName property, the project builds, but of course the events no longer fire properly.
<Window.Triggers><EventTriggerRoutedEvent="ToggleButton.Checked"SourceName="btnExpand"><BeginStoryboardStoryboard="{StaticResource ExpandisChecked}"/></EventTrigger><EventTriggerRoutedEvent="ToggleButton.Unchecked"SourceName="btnExpand"><BeginStoryboardStoryboard="{StaticResource ExpandisUnChecked}"/></EventTrigger></Window.Triggers>
Making the above into:
<Window.Triggers><EventTriggerRoutedEvent="ToggleButton.Checked"><BeginStoryboardStoryboard="{StaticResource ExpandisChecked}"/></EventTrigger><EventTriggerRoutedEvent="ToggleButton.Unchecked"><BeginStoryboardStoryboard="{StaticResource ExpandisUnChecked}"/></EventTrigger></Window.Triggers>
clears the error but doesn't provide functionality.
there stack trace shows:
System.Windows.Markup.XamlParseException occurredHResult=-2146233087LineNumber=226LinePosition=7Message='Initialization of 'TEST.MainWindow' threw an exception.'Line number '226' and line position '7'.Source=PresentationFrameworkStackTrace:
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader,IXamlObjectWriterFactory writerFactory,Boolean skipJournaledProperties,Object rootObject,XamlObjectWriterSettings settings,Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader,Boolean skipJournaledProperties,Object rootObject,XamlAccessLevel accessLevel,Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream,ParserContext parserContext,Object parent,Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component,Uri resourceLocator)
at TEST.MainWindow.InitializeComponent()in C:\Users\allusers\Documents\Visual Studio2015\Projects\TVROTR\TVROTR\MainWindow.xaml:line 1InnerException:HResult=-2146233067Message=Specified method is not supported.Source=NationalInstruments.ControlsStackTrace:
at NationalInstruments.Controls.Internal.MultiEnumerator.System.Collections.IEnumerator.Reset()
at System.Windows.LogicalTreeHelper.FindLogicalNode(DependencyObject logicalTreeNode,String elementName)
at System.Windows.LogicalTreeHelper.FindLogicalNode(DependencyObject logicalTreeNode,String elementName)
at System.Windows.LogicalTreeHelper.FindLogicalNode(DependencyObject logicalTreeNode,String elementName)
at System.Windows.LogicalTreeHelper.FindLogicalNode(DependencyObject logicalTreeNode,String elementName)
at System.Windows.FrameworkElement.FindNamedFrameworkElement(FrameworkElement startElement,String targetName)
at System.Windows.EventTrigger.ProcessOneTrigger(FrameworkElement triggersHost,TriggerBase triggerBase)
at System.Windows.EventTrigger.ProcessTriggerCollection(FrameworkElement triggersHost)
at System.Windows.FrameworkElement.TryFireInitialized()
at System.Windows.FrameworkElement.EndInit()
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType,Object obj,Boolean begin)InnerException:
How can I have both on the form at the same time?
here is the full code for the window if it helps:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TEST"
xmlns:ni="http://schemas.ni.com/controls/2009/xaml/presentation"
x:Class="TEST.MainWindow"
mc:Ignorable="d"Title="MainWindow"Height="768"Width="1024"WindowState="Maximized"WindowStyle="None"><Window.Resources><Style x:Key="ExpandCollapseToggle"TargetType="{x:Type ToggleButton}"><SetterProperty="Template"><Setter.Value><ControlTemplateTargetType="{x:Type ToggleButton}"><Border x:Name="borer"BorderThickness="1"CornerRadius="2"BorderBrush="{x:Null}"><Border x:Name="innerBorer"BorderThickness="1"CornerRadius="2"BorderBrush="#00FFFFFF"><Grid><Grid x:Name="BGCollection"Opacity="0"><Rectangle x:Name="rectangle"Opacity="1"RadiusX="15"RadiusY="15"Stroke="{x:Null}"><Rectangle.Fill><LinearGradientBrushEndPoint="0.5,1"StartPoint="0.5,0"><GradientStopColor="#FFB0B0B0"Offset="1"/><GradientStopColor="#FF615F5F"Offset="0.553"/><GradientStopColor="#FFD4D4D4"Offset="0"/></LinearGradientBrush></Rectangle.Fill></Rectangle></Grid><Path x:Name="path"Fill="{x:Null}"Stretch="Fill"HorizontalAlignment="Stretch"VerticalAlignment="Center"Height="50"Width="20"RenderTransformOrigin="0.5,0.52"Data="M4.5,2.0956774L8.25,5.8456774 4.5,9.5956774"Stroke="#FFEBF6FF"Margin="19.293,0,5.707,0"StrokeThickness="4"><Path.RenderTransform><TransformGroup><ScaleTransformScaleX="1"ScaleY="1"/><SkewTransformAngleX="0"AngleY="0"/><RotateTransformAngle="0"/><TranslateTransform X="0" Y="0"/></TransformGroup></Path.RenderTransform></Path><Path x:Name="path_Copy"Fill="{x:Null}"Stretch="Fill"HorizontalAlignment="Stretch"VerticalAlignment="Stretch"RenderTransformOrigin="0.5,0.5"Data="M4.5,2.0956774L8.25,5.8456774 4.5,9.5956774"Stroke="#FFEBF6FF"Margin="5.218,6,9.782,6"Height="50"Width="20"StrokeThickness="4"><Path.RenderTransform><TransformGroup><ScaleTransformScaleX="1"ScaleY="1"/><SkewTransformAngleX="0"AngleY="0"/><RotateTransformAngle="0"/><TranslateTransform X="0" Y="0"/></TransformGroup></Path.RenderTransform></Path></Grid></Border></Border><ControlTemplate.Triggers><TriggerProperty="IsChecked"Value="True"><SetterProperty="Data"TargetName="path_Copy"Value="M6.75,2.0956774L3,5.8456774 6.75,9.5956774"/><SetterProperty="Data"TargetName="path"Value="M6.75,2.0956774L3,5.8456774 6.75,9.5956774"/></Trigger><MultiTrigger><MultiTrigger.Conditions><ConditionProperty="IsChecked"Value="false"/><ConditionProperty="IsMouseOver"Value="true"/></MultiTrigger.Conditions>