ObservableValidator in .NET MAUI Toolkit - doc for EventTriggerBehavior? - mvvm

In the .NET MAUI Community Toolkit MVVM samples there is this XAML:
<Grid>
<muxc:InfoBar
x:Name="SuccessInfoBar"
Title="Success"
Message="The form was filled in correctly."
Severity="Success">
<interactivity:Interaction.Behaviors>
<interactions:EventTriggerBehavior EventName="FormSubmissionCompleted" SourceObject="{x:Bind ViewModel}">
<interactions:ChangePropertyAction
PropertyName="IsOpen"
TargetObject="{x:Bind SuccessInfoBar}"
Value="True" />
<interactions:ChangePropertyAction
PropertyName="IsOpen"
TargetObject="{x:Bind FailureInfoBar}"
Value="False" />
</interactions:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</muxc:InfoBar>
Can you tell me where I find documentation on EventTriggerBehavior? Or for that matter, where I find interactivity and Interaction.Behaviors and ChangePropertyAction?
I don't see this documented, despite searching.
Also, while I have you, this same code says
SourceObject="{x:Bind ViewModel}
Is Bind the same things as Binding?

EventTriggerBehavior: Listens for a specific event on its source and executes an action when the event is fired, it has two configurable properties (EventName and SourceObject).
ChangePropertyAction: Action that will change a specified property to a specified value when invoked.
For more information about Behaviors, you can check the documentation: XamlBehaviors
Regarding Bind and Binding, the {x:Bind} markup extension official document explains:
The {x:Bind} markup extension—new for Windows 10—is an alternative to
{Binding}. {x:Bind} runs in less time and less memory than {Binding}
and supports better debugging.
The difference to note is that the default mode of {x:Bind} is OneTime, which is different from {Binding}, whose default mode is OneWay.
For a comprehensive comparison between {x:Bind} and {Binding}, you can read Data binding in depth.

Related

cannot mention minimum value to the numeric component

Cannot mention minimum value and need to customize the arrow button
<NumericTextBoxComponent
validateDecimalOnType={true}
format='n2'
placeholder="Applied"
enabled={this.props.overApplied}
change={this.props.handleOverApplied}
value={this.props.added.value}
/>
Query-1: Setting minimum value
If you want to set minimum/maximum values in NumericTextBox, Please refer to the below range validation online sample,
<!-- Initialize Numeric Textbox -->
<ejs-numerictextbox id="numeric" min="10" max="100" value="15"></ejs-numerictextbox>
Sample : https://ej2.syncfusion.com/aspnetcore/NumericTextBox/RangeValidation#/material
Query-2: Customizing arrow buttons
To customize the arrow buttons to different icons, you can refer to the below how-to documentation page,
https://ej2.syncfusion.com/aspnetcore/documentation/numerictextbox/how-to/customize-the-spin-buttons-up-and-down-arrow/
Note:
We assumed that you are using ASP.Net Core and Provided the above information. If you are using different platform, the same links are available in that platform itself.

Problem with rule validation - valid on save, invalid on load

While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.
If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:
<if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>
But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.
While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:
{{c:"",h:"v120"}}
The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.
Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.
When saving the rule, the rule data (coming from the UI) is loaded into editor with
editor.LoadClientData(data.Data);
and when loading the rule it's loaded using the xml (from the storage) effectively calling this:
editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))
So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?
This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:
CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8

Adding suggestionItems Fails: "Cannot add direct child without default aggregation defined for control sap.m.SearchField"

I am adding a SearchField with suggestions in the XML view. When I execute, I get the error
Error: Cannot add direct child without default aggregation defined for control sap.m.SearchField.
Please tell me what mistake I am making.
<SearchField
placeholder="final search"
tooltip="Search for datastore source names"
suggestionItems="{/records}"
selectOnFocus="true"
>
<suggestionItems>
<SuggestionItem
text="{dbname}"
description="{dbname}"
/>
</suggestionItems>
</SearchField>
Try to have a look to this example
sap.m.Input
suggestionItems="{/ProductCollection}" is the collection with all the available entries, text="{Name}" is one of the attributes of the collection item.
Check this example without search help https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.InputSuggestionsDynamic/preview or https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.InputSuggestionsCustomFilter/preview
You must be using an old UI5 version. The aggregation suggestionItems was introduced in 1.34.
Here, you can see that the app crashes throwing the same error if run with the version lower than 1.34: https://jsbin.com/qepojux/edit?html,js,output
To see with which UI5 version the app is currently running, press Ctrl+Left Alt+Shift+P.
See also Versioning of SAPUI5.

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.

Conditional execution for ESB action

Is there a way in JBoss ESB so that an action can be conditionally executed.
My requirement is to conditionally transform an XML if the incoming XML has an attribute resubmitmode with tag value as true. Is there any way to do this with SmooksAction. I want to avoid the transformation if the tag value is false.
true
I did a lot of R&D but could not get this working. One alternative that came to mind was to add a transformation/XSLT rule but not sure if that would work
pasting snippet of jboss-esb.xml. smooks-res.xml contains the transformation rules.
<property name="smooksConfig" value="/smooks-res.xml"/>
<!-- property name="reportPath" value="/zap/smooks-report.html" / -->
</action>
I am using JBOSS SOA Enterprise platform 5.3 and ESB 4.11
I'd take a look at the ContentBasedRouter, and then route based on your condition. The fun_cbr quickstart should provide a decent example of how to do this.