-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainViewModel.cs
More file actions
25 lines (24 loc) · 856 Bytes
/
MainViewModel.cs
File metadata and controls
25 lines (24 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using DevExpress.Mvvm;
using XPOIssues.Issues;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Xpo;
using System.Linq;
using System.Collections.Generic;
namespace XPOIssues {
public class MainViewModel : ViewModelBase {
UnitOfWork _UnitOfWork;
IList<User> _ItemsSource;
public IList<User> ItemsSource {
get
{
if(_ItemsSource == null && !DevExpress.Mvvm.ViewModelBase.IsInDesignMode) {
_UnitOfWork = new UnitOfWork();
var xpCollection = new XPCollection<User>(_UnitOfWork);
xpCollection.Sorting.Add(new SortProperty(nameof(User.Oid), DevExpress.Xpo.DB.SortingDirection.Ascending));
_ItemsSource = xpCollection;
}
return _ItemsSource;
}
}
}
}