本文整理汇总了C#中System.Windows.Data.ListCollectionView.MoveCurrentToPosition方法的典型用法代码示例。如果您正苦于以下问题:C# ListCollectionView.MoveCurrentToPosition方法的具体用法?C# ListCollectionView.MoveCurrentToPosition怎么用?C# ListCollectionView.MoveCurrentToPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Data.ListCollectionView
的用法示例。
在下文中一共展示了ListCollectionView.MoveCurrentToPosition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeCarParentDialog
public ChangeCarParentDialog(CarObject car) {
InitializeComponent();
DataContext = this;
Buttons = new[] {
OkButton,
CreateExtraDialogButton(ControlsStrings.CarParent_MakeIndependent, () => {
Car.ParentId = null;
Close();
}),
CancelButton
};
Car = car;
Filter = car.Brand == null ? "" : @"brand:" + car.Brand;
CarsListView = new ListCollectionView(CarsManager.Instance.LoadedOnly.Where(x => x.ParentId == null && x.Id != Car.Id).ToList()) {
CustomSort = this
};
UpdateFilter();
if (car.Parent == null) {
CarsListView.MoveCurrentToPosition(0);
} else {
CarsListView.MoveCurrentTo(car.Parent);
}
Closing += CarParentEditor_Closing;
}
示例2: CustomerListModel
public CustomerListModel(List<Customer> data)
{
_data = data;
_customers = (ListCollectionView) CollectionViewSource.GetDefaultView(_data);
_customers.Filter = FilterCustomers;
_customers.CurrentChanged += CustomerChanged;
_customers.CustomSort = new CustomerSorter();
_customers.MoveCurrentToPosition(-1);
}
示例3: AccountTransactionViewModel
public AccountTransactionViewModel(IFileProcessorFactory processorFactory, IViewThreadExecutor viewThreadExecutor, IDataService dataService, IAccTransactionValidator validator)
{
var processorTable = processorFactory.ProcessorNames.ToDictionary(x => x, x => processorFactory.GetFileProcessor(x));
var details = processorFactory
.ProcessorNames
.Select(x =>
{
var fileProcessor = processorFactory.GetFileProcessor(x);
var allFileDetails = fileProcessor.GetAllFileNames()
.Select(fileName => new FileDetailViewModel(fileName, dataService, viewThreadExecutor, fileProcessor, validator))
.ToArray();
return new ProcessorDetails(x, allFileDetails);
}).ToList();
ProcessorDetails = new ListCollectionView(details);
if(details.Count > 0)
ProcessorDetails.MoveCurrentToPosition(0);
}
示例4: GetSitesView
public static ListCollectionView GetSitesView(OnlineVideosMainWindow window, string preselectedSiteName = null)
{
int? indexToSelect = null;
List<Site> convertedSites = new List<Site>();
int i = 0;
foreach (var s in OnlineVideos.OnlineVideoSettings.Instance.SiteUtilsList.Values)
{
if (preselectedSiteName != null && s.Settings.Name == preselectedSiteName) indexToSelect = i;
convertedSites.Add(new Site(s));
i++;
}
ListCollectionView view = new ListCollectionView(convertedSites)
{
Filter = new Predicate<object>(s => ((ViewModels.Site)s).Name.ToLower().Contains(window.CurrentFilter)),
};
if (indexToSelect != null) view.MoveCurrentToPosition(indexToSelect.Value);
return view;
}
示例5: WorkspaceViewModel
/// <summary>
/// Create a new instance of <see cref="WorkspaceViewModel"/>
/// </summary>
public WorkspaceViewModel()
{
ToggleControl = new DelegateCommand<UIElement>(this.OnToggleControl);
AddWorkspaceCommand = new DelegateCommand<TextBox>(
this.OnAddWorkspaceCommand);
RemoveWorkspaceCommand = new DelegateCommand(
this.OnRemoveWorkspaceCommand);
OpenWorkspace = new DelegateCommand(
this.OnOpenWorkspace);
ObservableCollection<WorkspaceModel> data = new ObservableCollection<WorkspaceModel>(
service.Load());
CurrentWorkspaces = new ListCollectionView(
data);
CurrentWorkspaces.MoveCurrentToPosition(-1);
CurrentWorkspaces.CurrentChanged += CurrentWorkspaces_CurrentChanged;
}
示例6: GetCategoriesView
public static ListCollectionView GetCategoriesView(OnlineVideosMainWindow window, IList<OnlineVideos.Category> categories, string preselectedCategoryName = null)
{
int? indexToSelect = null;
List<Category> convertedCategories = new List<Category>();
int i = 0;
if (categories != null)
{
foreach (var c in categories)
{
if (preselectedCategoryName != null && c.Name == preselectedCategoryName) indexToSelect = i;
convertedCategories.Add(new Category(c));
i++;
}
}
ListCollectionView view = new ListCollectionView(convertedCategories)
{
Filter = new Predicate<object>(cat => (((Category)cat).Name ?? "").ToLower().Contains(window.CurrentFilter))
};
if (indexToSelect != null) view.MoveCurrentToPosition(indexToSelect.Value);
return view;
}