本文整理汇总了C#中System.Windows.Data.ListCollectionView.MoveCurrentToFirst方法的典型用法代码示例。如果您正苦于以下问题:C# ListCollectionView.MoveCurrentToFirst方法的具体用法?C# ListCollectionView.MoveCurrentToFirst怎么用?C# ListCollectionView.MoveCurrentToFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Data.ListCollectionView
的用法示例。
在下文中一共展示了ListCollectionView.MoveCurrentToFirst方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnalyzerConfigurationViewModel
public AnalyzerConfigurationViewModel()
{
_issuesAnalyzer = ServiceLocator.Resolve<IssuesAnalyzerService>();
Analyzers = new ListCollectionView(_issuesAnalyzer.AnalyzerContext.Analyzers);
Analyzers.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
Analyzers.MoveCurrentToFirst();
}
示例2: ProcessorDetails
public ProcessorDetails(string code, params FileDetailViewModel[] fileDetails)
{
Code = code;
FileDetails = new ListCollectionView(fileDetails);
if(fileDetails.Length>0)
FileDetails.MoveCurrentToFirst();
}
示例3: ViewModel
public ViewModel(string key) {
NotesList = new ListCollectionView(ImportantTips.Entries.Where(x => !x.IsLimited || AppKeyHolder.IsAllRight).Reverse().ToList());
if (key != null) {
NotesList.MoveCurrentTo(ImportantTips.Entries.FirstOrDefault(x => x.Id?.Contains(key) == true));
} else {
NotesList.MoveCurrentToFirst();
}
}
示例4: AutomationViewModel
/// <summary>
/// Initializes a new instance of the <see cref="AutomationViewModel"/> class.
/// </summary>
public AutomationViewModel()
{
var automationTreeService = ServiceLocator.Resolve<AutomationTreeService>();
_selectedTreeItemService = ServiceLocator.Resolve<SelectedTreeItemService>();
Elements = new ListCollectionView(automationTreeService.Elements);
Elements.CurrentChanged += CurrentElementChanged;
Elements.MoveCurrentToFirst();
}
示例5: BindingEditorViewModel
/// <summary>
/// Initializes a new instance of the <see cref="BindingEditorViewModel"/> class.
/// </summary>
/// <param name="propertyItem">The property item.</param>
public BindingEditorViewModel(PropertyItem propertyItem)
{
_instance = (DependencyObject)propertyItem.Instance;
Sources = new ListCollectionView(Enum.GetValues(typeof(BindingSource)));
Sources.MoveCurrentToFirst();
Sources.CurrentChanged += (s, e) => OnSourceChanged();
Modes = new ListCollectionView(Enum.GetValues(typeof(BindingMode)));
Modes.MoveCurrentToFirst();
Modes.CurrentChanged += (s, e) => UpdateBinding();
UpdateSourceTriggers = new ListCollectionView(Enum.GetValues(typeof (UpdateSourceTrigger)));
UpdateSourceTriggers.MoveCurrentToFirst();
UpdateSourceTriggers.CurrentChanged += (s, e) => UpdateBinding();
SourceList = new ListCollectionView(_pathItems);
BuildSourceTree();
_dpd = DependencyPropertyDescriptor.FromProperty(propertyItem.Property);
_binding = BindingOperations.GetBinding((DependencyObject) propertyItem.Instance, _dpd.DependencyProperty);
if (_binding == null)
{
UpdateBinding();
}
else
{
if( _binding.Source == null )
{
Sources.MoveCurrentTo(BindingSource.DataContext);
}
else if( _binding.RelativeSource != null )
{
if( _binding.RelativeSource.Mode == RelativeSourceMode.PreviousData )
{
Sources.MoveCurrentTo(BindingSource.PreviousData);
}
else if( _binding.RelativeSource.Mode == RelativeSourceMode.TemplatedParent)
{
Sources.MoveCurrentTo(BindingSource.TemplatedParent);
}
else if( _binding.RelativeSource.Mode == RelativeSourceMode.FindAncestor)
{
Sources.MoveCurrentTo(BindingSource.FindAncestor);
}
}
UpdateExpression();
}
}
示例6: VisualTreeViewModel
/// <summary>
/// Initializes a new instance of the <see cref="VisualTreeViewModel"/> class.
/// </summary>
public VisualTreeViewModel()
{
_selectedTreeItemService = ServiceLocator.Resolve<SelectedTreeItemService>();
_selectedTreeItemService.SelectedTreeItemChanged += OnSelectedTreeItemChanged;
MouseElementServiceSettings = ServiceLocator.Resolve<MouseElementService>().Settings;
var visualTreeElementService = ServiceLocator.Resolve<VisualTreeService>();
visualTreeElementService.ElementsChanged += (s, e) => Elements.Refresh();
//FocusInfo = ServiceLocator.Resolve<FocusedElementService>().Info;
Elements = new ListCollectionView(visualTreeElementService.Elements);
Elements.CurrentChanged += CurrentElementChanged;
Elements.MoveCurrentToFirst();
}
示例7: ViewModel
public ViewModel() {
NotesList = new ListCollectionView(ReleaseNotes.Entries.Where(x => !x.IsLimited || AppKeyHolder.IsAllRight).ToList()) { CustomSort = this };
NotesList.MoveCurrentToFirst();
}
示例8: AdvancedTabViewModel
/// <summary>
/// Instantiates a new AdvancedTabViewModel.
/// </summary>
/// <param name="tree">The (not null) SkillTree instance to operate on.</param>
public AdvancedTabViewModel(SkillTree tree) : base(tree)
{
_attributes = CreatePossibleAttributes().ToList();
AttributesView = new ListCollectionView(_attributes)
{
Filter = item => !_addedAttributes.Contains(item),
CustomSort = Comparer<string>.Create((s1, s2) =>
{
// Sort by group as in AttrGroupOrder first and then by name.
var groupCompare = AttrGroupOrder[AttrToGroupConverter.Convert(s1)].CompareTo(
AttrGroupOrder[AttrToGroupConverter.Convert(s2)]);
return groupCompare != 0 ? groupCompare : string.CompareOrdinal(s1, s2);
})
};
AttributesView.GroupDescriptions.Add(new PropertyGroupDescription(".", AttrToGroupConverter));
AttributesView.MoveCurrentToFirst();
AttributeConstraints = new ObservableCollection<AttributeConstraint>();
NewAttributeConstraint = new AttributeConstraint(AttributesView.CurrentItem as string);
PseudoAttributesView = new ListCollectionView(_pseudoAttributes)
{
Filter = item => !_addedPseudoAttributes.Contains((PseudoAttribute) item)
};
PseudoAttributesView.SortDescriptions.Add(new SortDescription("Group", ListSortDirection.Ascending));
PseudoAttributesView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
PseudoAttributesView.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
PseudoAttributeConstraints = new ObservableCollection<PseudoAttributeConstraint>();
ReloadPseudoAttributes();
DisplayName = L10n.Message("Advanced");
}
示例9: InitializeBookes
private void InitializeBookes()
{
_localPath = Directory.GetCurrentDirectory();
if (string.IsNullOrEmpty(BooksXMLFile) || !File.Exists(BooksXMLFile))
{
BooksXMLFile = System.IO.Path.Combine(_localPath, "Resources\\books.xml");
}
if (!File.Exists(BooksXMLFile))
{
File.Create(BooksXMLFile);
}
EmptyImage = System.IO.Path.Combine(_localPath, "Resources\\Empty.png");
_bookList = new ObservableCollection<Book>();
using (FileStream stream = File.Open(BooksXMLFile, FileMode.Open))
{
XmlSerializer serializer = new XmlSerializer(typeof(ObservableCollection<Book>));
this._bookList = serializer.Deserialize(stream) as ObservableCollection<Book>;
}
foreach (Book book in this._bookList)
{
if (string.IsNullOrEmpty(book.Image))
{
book.Image = EmptyImage;
}
else
{
book.Image = book.Image.Replace("$(Booklist)", _localPath);
}
}
_booksView = new ListCollectionView(_bookList);
_booksView.MoveCurrentToFirst();
this._booksView.Refresh();
}
示例10: AdvancedTabViewModel
/// <summary>
/// Instantiates a new AdvancedTabViewModel.
/// </summary>
/// <param name="tree">The (not null) SkillTree instance to operate on.</param>
/// <param name="dialogCoordinator">The <see cref="IDialogCoordinator"/> used to display dialogs.</param>
/// <param name="dialogContext">The context used for <paramref name="dialogCoordinator"/>.</param>
/// <param name="runCallback">The action that is called when RunCommand is executed.</param>
public AdvancedTabViewModel(SkillTree tree, IDialogCoordinator dialogCoordinator, object dialogContext,
Action<GeneratorTabViewModel> runCallback)
: base(tree, dialogCoordinator, dialogContext, 3, runCallback)
{
AdditionalPoints = new LeafSetting<int>(nameof(AdditionalPoints), 21,
() => TotalPoints = Tree.Level - 1 + AdditionalPoints.Value);
TotalPoints = Tree.Level - 1 + AdditionalPoints.Value;
TreePlusItemsMode = new LeafSetting<bool>(nameof(TreePlusItemsMode), false);
WeaponClass = new LeafSetting<WeaponClass>(nameof(WeaponClass), Model.PseudoAttributes.WeaponClass.Unarmed,
() => WeaponClassIsTwoHanded = WeaponClass.Value.IsTwoHanded());
OffHand = new LeafSetting<OffHand>(nameof(OffHand), Model.PseudoAttributes.OffHand.Shield);
Tags = new LeafSetting<Tags>(nameof(Tags), Model.PseudoAttributes.Tags.None);
tree.PropertyChanged += (sender, args) =>
{
if (args.PropertyName == nameof(SkillTree.Level))
{
TotalPoints = Tree.Level - 1 + AdditionalPoints.Value;
}
};
_attributes = CreatePossibleAttributes().ToList();
AttributesView = new ListCollectionView(_attributes)
{
Filter = item => !_addedAttributes.Contains(item),
CustomSort = Comparer<string>.Create((s1, s2) =>
{
// Sort by group as in AttrGroupOrder first and then by name.
var groupCompare = AttrGroupOrder[AttrToGroupConverter.Convert(s1)].CompareTo(
AttrGroupOrder[AttrToGroupConverter.Convert(s2)]);
return groupCompare != 0 ? groupCompare : string.CompareOrdinal(s1, s2);
})
};
AttributesView.GroupDescriptions.Add(new PropertyGroupDescription(".", AttrToGroupConverter));
AttributesView.MoveCurrentToFirst();
AttributeConstraints = new ObservableCollection<AttributeConstraint>();
NewAttributeConstraint = new AttributeConstraint(AttributesView.CurrentItem as string);
PseudoAttributesView = new ListCollectionView(_pseudoAttributes)
{
Filter = item => !_addedPseudoAttributes.Contains((PseudoAttribute) item)
};
PseudoAttributesView.SortDescriptions.Add(new SortDescription("Group", ListSortDirection.Ascending));
PseudoAttributesView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
PseudoAttributesView.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
PseudoAttributeConstraints = new ObservableCollection<PseudoAttributeConstraint>();
ReloadPseudoAttributes();
DisplayName = L10n.Message("Advanced");
SubSettings = new ISetting[]
{
AdditionalPoints, Iterations, IncludeChecked, ExcludeCrossed,
TreePlusItemsMode, WeaponClass, OffHand, Tags,
new ConstraintsSetting(this)
};
}
示例11: MediaFileStateCollectionView
public MediaFileStateCollectionView(MediaFileState mediaState = null) :
base(mediaState)
{
Filter = filterFunc;
InfoIconsCache = InfoIconsCacheStatic;
MediaFilter = MediaFilterMode.None;
SortFunc = MediaFileSortFunctions.getSortFunction(MediaFileSortMode.Name);
SortMode = MediaFileSortMode.Name;
FilterModes = new ListCollectionView(Enum.GetValues(typeof(MediaFilterMode)));
SortItemCollection<MediaFileSortItem, MediaFileSortMode> mediaFileSortItemCollection = new SortItemCollection<MediaFileSortItem,MediaFileSortMode>();
mediaFileSortItemCollection.ItemSortDirectionChanged += mediaFileSortItemCollection_ItemSortDirectionChanged;
foreach(MediaFileSortMode mode in Enum.GetValues(typeof(MediaFileSortMode))) {
mediaFileSortItemCollection.Add(new MediaFileSortItem(mode));
}
SortModes = new ListCollectionView(mediaFileSortItemCollection);
SortModes.CurrentChanged += (s, e) =>
{
MediaFileSortItem sortItem = (MediaFileSortItem)SortModes.CurrentItem;
SortMode = sortItem.SortMode;
SortDirection = sortItem.SortDirection;
SortFunc = MediaFileSortFunctions.getSortFunction(SortMode);
refresh();
};
SortModes.Filter = mediaStateSortModeCollectionViewFilter;
FilterModes.CurrentChanged += (s, e) =>
{
MediaFilter = (MediaFilterMode)FilterModes.CurrentItem;
SortModes.Refresh();
bool isRefreshed = false;
switch (MediaFilter)
{
case MediaFilterMode.None:
if (!MediaFileSortFunctions.isAllSortMode(SortMode))
{
SortModes.MoveCurrentToFirst();
isRefreshed = true;
}
break;
case MediaFilterMode.Video:
if (!MediaFileSortFunctions.isVideoSortMode(SortMode))
{
SortModes.MoveCurrentToFirst();
isRefreshed = true;
}
break;
case MediaFilterMode.Images:
if (!MediaFileSortFunctions.isImageSortMode(SortMode))
{
SortModes.MoveCurrentToFirst();
isRefreshed = true;
}
break;
case MediaFilterMode.Audio:
if (!MediaFileSortFunctions.isAudioSortMode(SortMode))
{
SortModes.MoveCurrentToFirst();
isRefreshed = true;
}
break;
default:
break;
}
if (!isRefreshed)
{
refresh();
}
};
FilterModes.MoveCurrentTo(MediaFilterMode.None);
}