- realesmedia
- Posts: 85
- Joined:
NoesisApp :: DataTrigger does not work correctly
Hi
Noesis 2.2.4
value Prjoects.State = ProjectMenuState::Preview;
Initialize Control...
PropertyChangedTrigger::OnPostInit() -> NoesisApp::DataTrigger::Compare() -> return true
NoesisApp::DataTrigger::mBinding = 0;
NoesisApp::DataTrigger::mValue = value;
NoesisApp::DataTrigger::Copare() return true !!!!
trigger falsely triggered; Action called "Visibility" property set to "Hidden"
I added a comparison to zero at the beginning of the function:
if (mBinding == 0 || mValue == 0 || mComparator == 0) return false;
This works correctly, but you have this check inside the function. did you intentionally do that? or is it a mistake?
Noesis 2.2.4
Code: Select all
<PreviewProjectsControl
x:Class="PreviewProjectsControl"
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:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="dialog">
<i:Interaction.Triggers>
<ei:DataTrigger
Binding="{Binding Projects.State}"
Comparison="NotEqual"
Value="{x:Static ProjectMenuState.Preview}">
<ei:ChangePropertyAction PropertyName="Visibility" Value="Hidden" />
</ei:DataTrigger>
</i:Interaction.Triggers>
</PreviewProjectsControl>
Initialize Control...
PropertyChangedTrigger::OnPostInit() -> NoesisApp::DataTrigger::Compare() -> return true
NoesisApp::DataTrigger::mBinding = 0;
NoesisApp::DataTrigger::mValue = value;
NoesisApp::DataTrigger::Copare() return true !!!!
trigger falsely triggered; Action called "Visibility" property set to "Hidden"
I added a comparison to zero at the beginning of the function:
if (mBinding == 0 || mValue == 0 || mComparator == 0) return false;
This works correctly, but you have this check inside the function. did you intentionally do that? or is it a mistake?
Code: Select all
bool NoesisApp::DataTrigger::Compare()
{
if (mBinding == 0 || mValue == 0 || mComparator == 0) return false;
if (GetAssociatedObject() != 0)
{
if (mComparison == ComparisonConditionType_Equal)
{
return BaseObject::Equals(mBinding, mValue);
}
else if (mComparison == ComparisonConditionType_NotEqual)
{
return !BaseObject::Equals(mBinding, mValue);
}
else
{
if (mBinding == 0 || mValue == 0 || mComparator == 0)
{
return false;
}
return mComparator->Evaluate(mBinding, mComparison, mValue);
}
}
return false;
}
- realesmedia
- Posts: 85
- Joined:
Re: NoesisApp :: DataTrigger does not work correctly
Understood, I need to do two triggers:
Code: Select all
<i:Interaction.Triggers>
<ei:DataTrigger
Binding="{Binding Projects.State}"
Comparison="NotEqual"
Value="{x:Static ProjectMenuState.Preview}">
<ei:ChangePropertyAction PropertyName="Visibility" Value="Hidden" />
</ei:DataTrigger>
<ei:DataTrigger
Binding="{Binding Projects.State}"
Comparison="Equal"
Value="{x:Static ProjectMenuState.Preview}">
<ei:ChangePropertyAction PropertyName="Visibility" Value="Visible" />
</ei:DataTrigger>
</i:Interaction.Triggers>
Re: NoesisApp :: DataTrigger does not work correctly
Thanks for the feedback! Marking this as solved.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests