-
-
Notifications
You must be signed in to change notification settings - Fork 41
PositionInListview
The PositionInListView
, controls how objects are positioned in a ListView at runtime.
Credits: to the Company (wants anonymity) that sponsor the initial implementation of this module.
This is a platform agnostic
module that is designed to sort a ListView based on a existing Business Object member. It is possible to define one configuration for each ListView and choose the sorting member from the model as shown:
For the configured ListViews the MoveObjectUp
and MoveObjectDown
actions will be active and they can be used to change the order. The module on the background swaps the values of the model configured PositionMember
on each action execute resulting in a persistent ListView order.
The ListView sorting happens when a ListView is created on the CollectionSource object. For cases that the CollectionSource is not sortable e.g. (non-persistent) sorting is done explicitly. In addition ListView sorting and grouping from the UI Editor are disabled and the PositionMember
modification are not committed explicitly.
For new Business objects the module will automatically update the configured members as per model configuration as shown:
If a NewObjectsStrategy
for the ModelClass is not configured it defaults to Last
. The strategy is not applied to objects created from a ModuleUpdater.
In the screencast we create three customers at runtime and demo the feature by executing the MoveUp/MoveDown actions and close/reopen the view`. At the bottom the Reactive.Logger.Client.Win
Possible future improvements:
- Moving multiple positions at once.
- Moving multiple objects.
- Conditional NewObjectsStrategy.
- Conditional persistance PositionMember modifications.
- Enable temporarily UI sorting and grouping on the ListView.
- Any other need you may have.
Let me know if you want me to implement them for you.
-
First you need the nuget package so issue this command to the
VS Nuget package console
Install-Package Xpand.XAF.Modules.PositionInListView
.The above only references the dependencies and next steps are mandatory.
-
Ways to Register a Module or simply add the next call to your module constructor
RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.PositionInListViewModule));
The module is not bound to DevExpress versioning, which means you can use the latest version with your old DevExpress projects Read more.
The module follows the Nuget Version Basics.
.NetFramework: net461
DevExpress.ExpressApp | Any |
Fasterflect.Xpand | 2.0.7 |
JetBrains.Annotations | 2019.1.3 |
System.ValueTuple | 4.5.0 |
Xpand.Extensions | 2.201.29 |
Xpand.Extensions.XAF | 2.201.29 |
Xpand.VersionConverter | 2.201.7 |
To Step in the source code
you need to enable Source Server support
in your Visual Studio/Tools/Options/Debugging/Enable Source Server Support. See also How to boost your DevExpress Debugging Experience.
If the package is installed in a way that you do not have access to uninstall it, then you can unload
it with the next call at the constructor of your module.
Xpand.XAF.Modules.Reactive.ReactiveModuleBase.Unload(typeof(Xpand.XAF.Modules.PositionInListView.PositionInListViewModule))
The module is tested on Azure for each build with these tests. All Tests run as per our Compatibility Matrix