本文整理汇总了C#中System.Windows.Data.ListCollectionView类的典型用法代码示例。如果您正苦于以下问题:C# ListCollectionView类的具体用法?C# ListCollectionView怎么用?C# ListCollectionView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListCollectionView类属于System.Windows.Data命名空间,在下文中一共展示了ListCollectionView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PositionOrganizationChartsVM
public PositionOrganizationChartsVM(PositionVM position, AccessType access)
: base(access)
{
UnitOfWork = new SoheilEdmContext();
CurrentPosition = position;
PositionDataService = new PositionDataService(UnitOfWork);
PositionDataService.OrganizationChartAdded += OnOrganizationChartAdded;
PositionDataService.OrganizationChartRemoved += OnOrganizationChartRemoved;
OrganizationChartDataService = new OrganizationChartDataService(UnitOfWork);
OrganizationChartPositionDataService = new OrganizationChartPositionDataService(UnitOfWork);
var selectedVms = new ObservableCollection<OrganizationChartPositionVM>();
foreach (var positionOrganizationChart in PositionDataService.GetOrganizationCharts(position.Id))
{
selectedVms.Add(new OrganizationChartPositionVM(positionOrganizationChart, Access, OrganizationChartPositionDataService));
}
SelectedItems = new ListCollectionView(selectedVms);
var allVms = new ObservableCollection<OrganizationChartVM>();
foreach (var organizationChart in OrganizationChartDataService.GetActives())
{
allVms.Add(new OrganizationChartVM(organizationChart, Access, OrganizationChartDataService));
}
AllItems = new ListCollectionView(allVms);
IncludeCommand = new Command(Include, CanInclude);
ExcludeCommand = new Command(Exclude, CanExclude);
}
示例2: ProductDefectionsVM
public ProductDefectionsVM(ProductVM product, AccessType access):base(access)
{
UnitOfWork = new SoheilEdmContext();
CurrentProduct = product;
ProductDataService = new ProductDataService(UnitOfWork);
ProductDataService.DefectionAdded += OnDefectionAdded;
ProductDataService.DefectionRemoved += OnDefectionRemoved;
DefectionDataService = new DefectionDataService(UnitOfWork);
ProductDefectionDataService = new ProductDefectionDataService(UnitOfWork);
var selectedVms = new ObservableCollection<ProductDefectionVM>();
foreach (var productDefection in ProductDataService.GetDefections(product.Id))
{
selectedVms.Add(new ProductDefectionVM(productDefection, Access, ProductDefectionDataService, RelationDirection.Straight));
}
SelectedItems = new ListCollectionView(selectedVms);
var allVms = new ObservableCollection<DefectionVM>();
foreach (var defection in DefectionDataService.GetActives(SoheilEntityType.Products, CurrentProduct.Id))
{
allVms.Add(new DefectionVM(defection, Access, DefectionDataService));
}
AllItems = new ListCollectionView(allVms);
IncludeCommand = new Command(Include, CanInclude);
ExcludeCommand = new Command(Exclude, CanExclude);
IncludeRangeCommand = new Command(IncludeRange, CanIncludeRange);
ExcludeRangeCommand = new Command(ExcludeRange, CanExcludeRange);
}
示例3: ProcessorDetails
public ProcessorDetails(string code, params FileDetailViewModel[] fileDetails)
{
Code = code;
FileDetails = new ListCollectionView(fileDetails);
if(fileDetails.Length>0)
FileDetails.MoveCurrentToFirst();
}
示例4: EnumerableCollectionView
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
// Set up a ListCollectionView over the
// snapshot. We will delegate all CollectionView functionality
// to this view.
internal EnumerableCollectionView(IEnumerable source)
: base(source, -1)
{
_snapshot = new ObservableCollection<object>();
LoadSnapshotCore(source);
if (_snapshot.Count > 0)
{
SetCurrent(_snapshot[0], 0, 1);
}
else
{
SetCurrent(null, -1, 0);
}
// if the source doesn't raise collection change events, try to
// detect changes by polling the enumerator
_pollForChanges = !(source is INotifyCollectionChanged);
_view = new ListCollectionView(_snapshot);
INotifyCollectionChanged incc = _view as INotifyCollectionChanged;
incc.CollectionChanged += new NotifyCollectionChangedEventHandler(_OnViewChanged);
INotifyPropertyChanged ipc = _view as INotifyPropertyChanged;
ipc.PropertyChanged += new PropertyChangedEventHandler(_OnPropertyChanged);
_view.CurrentChanging += new CurrentChangingEventHandler(_OnCurrentChanging);
_view.CurrentChanged += new EventHandler(_OnCurrentChanged);
}
示例5: FishboneNodeActionPlansVM
public FishboneNodeActionPlansVM(FishboneNodeVM defection, AccessType access)
: base(access)
{
UnitOfWork = new SoheilEdmContext();
CurrentFishboneNode = defection;
FishboneNodeDataService = new FishboneNodeDataService(UnitOfWork);
FishboneNodeDataService.ActionPlanAdded += OnActionPlanAdded;
FishboneNodeDataService.ActionPlanRemoved += OnActionPlanRemoved;
ActionPlanDataService = new ActionPlanDataService(UnitOfWork);
var selectedVms = new ObservableCollection<ActionPlanFishboneVM>();
foreach (var productFishboneNode in FishboneNodeDataService.GetActionPlans(defection.Id))
{
selectedVms.Add(new ActionPlanFishboneVM(productFishboneNode, Access, RelationDirection.Reverse));
}
SelectedItems = new ListCollectionView(selectedVms);
var allVms = new ObservableCollection<ActionPlanVM>();
foreach (var actionPlan in ActionPlanDataService.GetActives())
{
allVms.Add(new ActionPlanVM(actionPlan, Access, ActionPlanDataService));
}
AllItems = new ListCollectionView(allVms);
IncludeCommand = new Command(Include, CanInclude);
ExcludeCommand = new Command(Exclude, CanExclude);
}
示例6: ActivityOperatorsVM
public ActivityOperatorsVM(ActivityVM activity, AccessType access)
: base(access)
{
UnitOfWork = new SoheilEdmContext();
CurrentActivity = activity;
ActivityDataService = new ActivityDataService(UnitOfWork);
ActivityDataService.OperatorAdded += OnOperatorAdded;
ActivityDataService.OperatorRemoved += OnOperatorRemoved;
OperatorDataService = new OperatorDataService(UnitOfWork);
ActivityOperatorDataService = new ActivitySkillDataService(UnitOfWork);
var selectedVms = new ObservableCollection<ActivityOperatorVM>();
foreach (var activityOperator in ActivityDataService.GetOperators(activity.Id))
{
selectedVms.Add(new ActivityOperatorVM(activityOperator, Access, ActivityOperatorDataService, RelationDirection.Straight));
}
SelectedItems = new ListCollectionView(selectedVms);
var allVms = new ObservableCollection<OperatorVM>();
foreach (var opr in OperatorDataService.GetActives(SoheilEntityType.Activities, CurrentActivity.Id))
{
allVms.Add(new OperatorVM(opr, Access, OperatorDataService));
}
AllItems = new ListCollectionView(allVms);
IncludeCommand = new Command(Include, CanInclude);
ExcludeCommand = new Command(Exclude, CanExclude);
}
示例7: MainViewModel
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
public MainViewModel()
{
LoadUrlCommand = new RelayCommand(OnLoadUrl);
ParseUrlCommand = new RelayCommand(OnParseUrl, () => !string.IsNullOrEmpty(URL));
ExportCommand = new RelayCommand(OnExport);
GetUrlsCommand = new RelayCommand(OnGetUrls);
_catalogObservableList = new ObservableCollection<CatalogNodeViewModel>();
CatalogCollectionView = new ListCollectionView(_catalogObservableList);
if (IsInDesignMode)
{
// Code runs in Blend --> create design time data.
URL = "http://hqfz.cnblgos.com";
CnBlogName = "hqfz";
var catalog = new CatalogNodeViewModel();
catalog.CurrentEntity.Title = "Catalog1";
var article = new ArticleViewModel();
article.CurrentEntity.Title = "Article1";
catalog.AddArticle(article);
_catalogObservableList.Add(catalog);
}
else
{
// Code runs "for real"
URL = "http://www.cnblogs.com/artech/default.html?page=1";
CnBlogName = "artech";
}
}
示例8: EnumPropertyItem
public EnumPropertyItem(PropertyDescriptor property, object instance)
: base(property, instance)
{
EnumValues = new ListCollectionView(Enum.GetValues(property.PropertyType));
EnumValues.MoveCurrentTo(property.GetValue(instance));
EnumValues.CurrentChanged += OnEnumValueChanged;
}
示例9: CatalogNodeViewModel
public CatalogNodeViewModel(Catalog catalog)
{
CurrentEntity = catalog;
_articlesObservableList = new ObservableCollection<ArticleViewModel>();
ArticlesCollectionView = new ListCollectionView(_articlesObservableList);
}
示例10: StatementVm
public StatementVm(List<StatementDataModel> statementList, IEnumerable<Signal> avalibleSignals)
{
IS_SAVED = false;
_avalibleSignals = avalibleSignals;
_statementValuesList = statementList;
//var statementvalue = new StatementDataModel(_avalibleSignals, StatementDataModelType.RegularStatement);
//statementvalue.IsAlgebraOperatorVisible = false;
//statementvalue.PropertyChanged += StatementValueField_Changed;
//_statementValuesList.Add(statementvalue);
ObservableStatements = new ListCollectionView(_statementValuesList);
ObservableStatements.CollectionChanged += ObservableStatements_CollectionChanged;
_addRegularExpressionCommand = new DelegateCommand<string>(
(s) => { AddRegularExpression(); }, //Execute
(s) => { return true; } //CanExecute
);
_addTimeExpressionCommand = new DelegateCommand<string>(
(s) => { AddTimeExpression(); }, //Execute
(s) => { return true; } //CanExecute
);
_removeExpressionCommand = new DelegateCommand<string>(
(s) => { RemoveRow(); }, //Execute
(s) => { return true; } //CanExecute
);
_saveStatementCommand = new DelegateCommand<string>(
(s) => { Save(); }, //Execute
(s) => { return IsDataValid(); } //CanExecute
);
}
示例11: LookupComboboxBindingWindow_Loaded
private void LookupComboboxBindingWindow_Loaded(object sender, RoutedEventArgs e)
{
IQueryable<Order> query = from o in db.Orders
//where o.OrderDate >= System.Convert.ToDateTime("1/1/2009")
orderby o.OrderDate descending, o.Customer.LastName
select o;
this.OrderData = new OrdersCollection(query, db);
// Make sure the lookup list is pulled from the same ObjectContext
// (OMSEntities) that the order query uses above.
// Also have to make sure you return a list of Customer entites and not a
// projection of just a few fields otherwise the binding won't work).
IQueryable<Customer> customerList = from c in db.Customers
where c.Orders.Count > 0
orderby c.LastName, c.FirstName
select c;
CollectionViewSource orderSource = (CollectionViewSource)this.FindResource("OrdersSource");
orderSource.Source = this.OrderData;
CollectionViewSource customerSource = (CollectionViewSource)this.FindResource("CustomerLookup");
customerSource.Source = customerList; //.ToArray(); //.ToList(); // A simple list is OK here since we are not editing Customers
this.View = (ListCollectionView)orderSource.View;
}
示例12: UserPositionsVM
public UserPositionsVM(UserVM user, AccessType access)
: base(access)
{
UnitOfWork = new SoheilEdmContext();
CurrentUser = user;
UserDataService = new UserDataService(UnitOfWork);
PositionDataService = new PositionDataService(UnitOfWork);
AccessRuleDataService = new AccessRuleDataService(UnitOfWork);
UserDataService.PositionAdded += OnPositionAdded;
UserDataService.PositionRemoved += OnPositionRemoved;
var selectedVms = new ObservableCollection<UserPositionVM>();
foreach (var userPosition in UserDataService.GetPositions(user.Id))
{
selectedVms.Add(new UserPositionVM(userPosition, Access, RelationDirection.Straight));
}
SelectedItems = new ListCollectionView(selectedVms);
var allVms = new ObservableCollection<PositionVM>();
foreach (var position in PositionDataService.GetActives(SoheilEntityType.Users, CurrentUser.Id))
{
allVms.Add(new PositionVM(position, Access, PositionDataService));
}
AllItems = new ListCollectionView(allVms);
//AllItems = new ListCollectionView(PositionDataService.GetActives());
IncludeCommand = new Command(Include, CanInclude);
ExcludeCommand = new Command(Exclude, CanExclude);
}
示例13: Window1_Loaded
private void Window1_Loaded(object sender, RoutedEventArgs e)
{
IQueryable<Order> query = from o in db.Orders.Include("OrderDetails")
//where o.OrderDate >= System.Convert.ToDateTime("1/1/2009")
orderby o.OrderDate descending, o.Customer.LastName
select o;
this.OrderData = new OrdersCollection(query, db);
IQueryable<Customer> customerList = from c in db.Customers
where c.Orders.Count > 0
orderby c.LastName, c.FirstName
select c;
IQueryable<Product> productList = from p in db.Products
orderby p.Name
select p;
this.MasterViewSource = (CollectionViewSource)this.FindResource("MasterViewSource");
this.DetailViewSource = (CollectionViewSource)this.FindResource("DetailsViewSource");
this.MasterViewSource.Source = this.OrderData;
CollectionViewSource customerSource = (CollectionViewSource)this.FindResource("CustomerLookup");
customerSource.Source = customerList.ToList(); // A simple list is OK here since we are not editing Customers
CollectionViewSource productSource = (CollectionViewSource)this.FindResource("ProductLookup");
productSource.Source = productList.ToList(); // A simple list is OK here since we are not editing Products
this.MasterView = (ListCollectionView)this.MasterViewSource.View;
MasterView.CurrentChanged += new EventHandler(MasterView_CurrentChanged);
this.DetailsView = (BindingListCollectionView)this.DetailViewSource.View;
}
示例14: PositionUsersVM
public PositionUsersVM(PositionVM position, AccessType access)
: base(access)
{
UnitOfWork = new SoheilEdmContext();
CurrentPosition = position;
PositionDataService = new PositionDataService(UnitOfWork);
PositionDataService.UserAdded += OnUserAdded;
PositionDataService.UserRemoved += OnUserRemoved;
UserDataService = new UserDataService(UnitOfWork);
var selectedVms = new ObservableCollection<UserPositionVM>();
foreach (var positionUser in PositionDataService.GetUsers(position.Id))
{
selectedVms.Add(new UserPositionVM(positionUser, Access, RelationDirection.Reverse));
}
SelectedItems = new ListCollectionView(selectedVms);
var allVms = new ObservableCollection<UserVM>();
foreach (var user in UserDataService.GetActives(SoheilEntityType.Positions, CurrentPosition.Id))
{
allVms.Add(new UserVM(user, Access, UserDataService));
}
AllItems = new ListCollectionView(allVms);
IncludeCommand = new Command(Include, CanInclude);
ExcludeCommand = new Command(Exclude, CanExclude);
}
示例15: ImageSearchSettingsViewModel
public ImageSearchSettingsViewModel() : base("Image Search Plugin", new Uri(typeof(ImageSearchSettingsView).FullName, UriKind.Relative))
{
DirectoryPickerCommand = new Command(() =>
{
DirectoryPickerView directoryPicker = new DirectoryPickerView();
DirectoryPickerViewModel vm = (DirectoryPickerViewModel)directoryPicker.DataContext;
vm.SelectedPath = FixedDownloadPath;
if (directoryPicker.ShowDialog() == true)
{
FixedDownloadPath = vm.SelectedPath;
MiscUtils.insertIntoHistoryCollection(FixedDownloadPathHistory, FixedDownloadPath);
}
});
ImageSaveMode = new ListCollectionView(Enum.GetValues(typeof(MediaViewer.Infrastructure.Constants.SaveLocation)));
ImageSaveMode.MoveCurrentTo(ImageSearchPlugin.Properties.Settings.Default.ImageSaveMode);
if (String.IsNullOrEmpty(ImageSearchPlugin.Properties.Settings.Default.FixedDownloadPath))
{
FixedDownloadPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
}
else
{
FixedDownloadPath = ImageSearchPlugin.Properties.Settings.Default.FixedDownloadPath;
}
FixedDownloadPathHistory = ImageSearchPlugin.Properties.Settings.Default.FixedDownloadPathHistory;
}