Changes

Property Direct Edit (Client)

1,789 bytes added, 12:21, 28 January 2022
* With selective list items: named as UBIKTaskPropertyList.
[[Category:Client|Property Direct Edit (Client)]][[Category:Version 4.0|Property Direct Edit (Client)]][[Category:WinX|Property Direct Edit (Client)]][[Category:Xamarin|Property Direct Edit (Client)]]
== PropertyViewModel ==
* '''StartDirectEditCommand''': Sets InEdit to true and starts the direct editing session. In the example, this is linked to the tapped event of the entire template area;
* '''ConfirmEditCommand''': Confirms the edit and sets InEdit to false. Even if the property value is not changed, this will give the property a new validation timestamp, technically modifying the property;
<tabs>
Optional command parameter for ConfirmEditCommand: ToValidate - Whether a validation timestamp should be added even if the value is unchanged when confirmed. Defaults to true if unspecified.
<tab name="UWP">
<source lang = "xml">
<Button ...
xmlns:uc="using:UBIK.WinX.Controls"
Command="{Binding ConfirmEditCommand}">
<Button.CommandParameter>
<uc:KeyValueList>
<uc:KeyValueParameter Key="ToValidate" Value="false" />
</uc:KeyValueList>
</Button.CommandParameter>
</Button>
</source>
</tab>
 
<tab name="Xamarin">
<source lang = "xml">
<Button ...
xmlns:classes="clr-namespace:UBIK.CPL.Classes;assembly=UBIK.CPL"
Command="{Binding ConfirmEditCommand}">
<Button.CommandParameter>
<classes:KeyValueList>
<classes:KeyValueParameter Key="ToValidate" Value="false" />
</classes:KeyValueList>
</Button.CommandParameter>
</Button>
</source>
</tab>
</tabs>
* '''SaveAndCommitCommand''': In addition to confirming the edit, this also saves the changes to the underlying property, saves the owner object and attempts to commit it if the sync mode allows;
* '''ResetCommand''': Resets the underlying property to its last known server state, saves the owner object and attempts to commit it if the sync mode allows;
* '''DiscardChangeCommand''': Discards all changes made at the PropertyViewModel level that not yet saved to the underlying property;
* '''DeleteValueCommand''': Sets the underlying property's value(s) to null and erases its validation timestamp, saves the owner object and attempts to commit it if the sync mode allows;
<tabs>
Optional command parameter for ResetCommand and DeleteValueCommand: AutoSave - Whether the change(s) to the property and the object should be saved right after the execution of these commands. Defaults to true if unspecified.
<tab name="UWP">
<source lang = "xml">
<Button ...
xmlns:uc="using:UBIK.WinX.Controls"
Command="{Binding DeleteValueCommand}">
<Button.CommandParameter>
<uc:KeyValueList>
<uc:KeyValueParameter Key="AutoSave" Value="false" />
</uc:KeyValueList>
</Button.CommandParameter>
</Button>
</source>
</tab>
 
<tab name="Xamarin">
<source lang = "xml">
<Button ...
xmlns:classes="clr-namespace:UBIK.CPL.Classes;assembly=UBIK.CPL"
Command="{Binding DeleteValueCommand}">
<Button.CommandParameter>
<classes:KeyValueList>
<classes:KeyValueParameter Key="AutoSave" Value="false" />
</classes:KeyValueList>
</Button.CommandParameter>
</Button>
</source>
</tab>
</tabs>
* '''DiscardChangeCommand''': Discards all changes made at the PropertyViewModel level that not yet saved to the underlying property;
* '''CancelEditCommand''': Cancels the current editing session and discards all changes made at the PropertyViewModel level '''in that session''' (different from DiscardChangeCommand).