Steback
Topic Author
Posts: 8
Joined: 28 Jul 2020, 19:58

'NotEqual' is not a valid value for property NoesisApp.DataTrigger.Comparison.

11 Nov 2020, 01:15

Hi. I am trying to change the visibility property of a view according to events.

I have this code in the xaml file. I use the Menu3D sample as a guide.
<i: Interaction.Triggers>
	<ei: DataTrigger Binding = "{Binding State}" Comparison = "NotEqual" Value = "{x: Local Static: State.MainMenu}">
		 <ei: ChangePropertyAction PropertyName = "Visibility" Value = "Hidden" />
	</ ei: DataTrigger>
	<ei: DataTrigger Binding = "{Binding State}" Comparison = "Equal" Value = "{x: Local Static: State.MainMenu}">
		<ei: ChangePropertyAction PropertyName = "Visibility" Value = "Visible" />
	</ ei: DataTrigger>
</i:Interaction.Triggers>
Why this error appears and how I can solve it?

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 2056
Joined: 22 Dec 2011, 19:20

Re: 'NotEqual' is not a valid value for property NoesisApp.DataTrigger.Comparison.

11 Nov 2020, 10:19

I assume you are including Interactivity source code in your game/app, or linking against NoesisApp.lib. And registering all the components from that package: viewtopic.php?f=3&t=1893#p10663 or viewtopic.php?f=3&t=1893&start=10#p10664

Anyway, I see you are setting Value property with "{x:Local Static:State.MainMenu}", that is not correct, it should be:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:Local="clr-namespace:YourNamespace">
  <i: Interaction.Triggers>
    <ei:DataTrigger Binding="{Binding State}" Comparison="NotEqual" Value="{x:Static Local:State.MainMenu}">
      <ei:ChangePropertyAction PropertyName="Visibility" Value="Hidden" />
    </ei:DataTrigger>
    <ei:DataTrigger Binding="{Binding State}" Comparison="Equal" Value="{x:Static Local:State.MainMenu}">
      <ei:ChangePropertyAction PropertyName="Visibility" Value="Visible" />
    </ei:DataTrigger>
  </i:Interaction.Triggers>
</Grid>
The markup extension is x:Static, then you specify the static type member with Local:State.MainMenu. "Local" prefix is replaced during xaml parse with the specified namespace to resolve the type name, in this case will be "YourNamespace.State". If that type is an enum, then "MainMenu" will be one of the values of the enum.
 
Steback
Topic Author
Posts: 8
Joined: 28 Jul 2020, 19:58

Re: 'NotEqual' is not a valid value for property NoesisApp.DataTrigger.Comparison.

11 Nov 2020, 15:12

Thanks for the help. the error was I did not add this component
Noesis::RegisterComponent<Noesis::EnumConverter<NoesisApp::ComparisonConditionType>>();
 
User avatar
jsantos
Site Admin
Posts: 3015
Joined: 20 Jan 2012, 17:18
Contact:

Re: 'NotEqual' is not a valid value for property NoesisApp.DataTrigger.Comparison.

13 Nov 2020, 11:09

Great! Marking this as solved.

Who is online

Users browsing this forum: Google [Bot] and 0 guests