本文整理汇总了C#中System.Windows.Data.ListCollectionView.MoveCurrentTo方法的典型用法代码示例。如果您正苦于以下问题:C# ListCollectionView.MoveCurrentTo方法的具体用法?C# ListCollectionView.MoveCurrentTo怎么用?C# ListCollectionView.MoveCurrentTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Data.ListCollectionView
的用法示例。
在下文中一共展示了ListCollectionView.MoveCurrentTo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: 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;
}
示例3: 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;
}
示例4: VideoSettingsViewModel
public VideoSettingsViewModel() :
base("Video", new Uri(typeof(VideoSettingsView).FullName, UriKind.Relative))
{
DirectoryPickerCommand = new Command(() =>
{
DirectoryPickerView directoryPicker = new DirectoryPickerView();
DirectoryPickerViewModel vm = (DirectoryPickerViewModel)directoryPicker.DataContext;
vm.SelectedPath = VideoScreenShotLocation;
vm.PathHistory = VideoScreenShotLocationHistory;
if (directoryPicker.ShowDialog() == true)
{
VideoScreenShotLocation = vm.SelectedPath;
}
});
VideoScreenShotLocationHistory = Settings.Default.VideoScreenShotLocationHistory;
if (String.IsNullOrEmpty(Settings.Default.VideoScreenShotLocation))
{
Settings.Default.VideoScreenShotLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
}
VideoScreenShotSaveMode = new ListCollectionView(Enum.GetValues(typeof(Infrastructure.Constants.SaveLocation)));
VideoScreenShotSaveMode.MoveCurrentTo(Settings.Default.VideoScreenShotSaveMode);
VideoScreenShotLocation = Settings.Default.VideoScreenShotLocation;
VideoScreenShotTimeOffset = Settings.Default.VideoScreenShotTimeOffset;
MinNrBufferedPackets = Settings.Default.VideoMinBufferedPackets;
StepDurationSeconds = Settings.Default.VideoStepDurationSeconds;
MaxNrBufferedPackets = 1000;
}
示例5: 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;
}
示例6: GridLengthPropertyItem
/// <summary>
/// Initializes a new instance of the <see cref="GridLengthPropertyItem"/> class.
/// </summary>
/// <param name="property"></param>
/// <param name="instance"></param>
public GridLengthPropertyItem(PropertyDescriptor property, object instance)
: base(property, instance)
{
var unitTypes = new List<GridUnitType>{ GridUnitType.Auto, GridUnitType.Pixel, GridUnitType.Star };
UnitTypes = new ListCollectionView(unitTypes);
UnitTypes.MoveCurrentTo(GetValue().GridUnitType);
UnitTypes.CollectionChanged += (s, e) => UpdateGridLength(Units);
}
示例7: 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();
}
}
示例8: StepViewModel
public StepViewModel(StepTypes type, JavaScriptEvent ev)
{
IsSelected = true;
Status = null;
StepType = CollectionViewSource.GetDefaultView(StepTypeCollection);
JavaScriptEvents = new ListCollectionView(new[] { JavaScriptEvent.Click, JavaScriptEvent.KeyUp });
StepType.CurrentChanged += OnStepTypeChanged;
JavaScriptEvents.CurrentChanged += OnJavaScriptEventsChanged;
StepType.MoveCurrentTo(type);
JavaScriptEvents.MoveCurrentTo(ev);
}
示例9: ImageSearchViewModel
//.........这里部分代码省略.........
MediaStateCollectionView.deselectAll();
});
CloseCommand = new Command(() =>
{
OnClosingRequest();
});
DownloadCommand = new AsyncCommand<SelectableMediaItem>(async (selectableItem) =>
{
List<MediaItem> items = MediaStateCollectionView.getSelectedItems();
if (items.Count == 0)
{
items.Add(selectableItem.Item);
}
String outputPath = null;
switch (ImageSearchPlugin.Properties.Settings.Default.ImageSaveMode)
{
case MediaViewer.Infrastructure.Constants.SaveLocation.Current:
{
outputPath = MediaFileWatcher.Instance.Path;
break;
}
case MediaViewer.Infrastructure.Constants.SaveLocation.Ask:
{
DirectoryPickerView directoryPicker = new DirectoryPickerView();
directoryPicker.DirectoryPickerViewModel.InfoString = "Select Output Directory";
directoryPicker.DirectoryPickerViewModel.SelectedPath = MediaFileWatcher.Instance.Path;
if (directoryPicker.ShowDialog() == false)
{
return;
}
outputPath = directoryPicker.DirectoryPickerViewModel.SelectedPath;
break;
}
case MediaViewer.Infrastructure.Constants.SaveLocation.Fixed:
{
outputPath = ImageSearchPlugin.Properties.Settings.Default.FixedDownloadPath;
break;
}
default:
break;
}
CancellableOperationProgressView progressView = new CancellableOperationProgressView();
DownloadProgressViewModel vm = new DownloadProgressViewModel();
progressView.DataContext = vm;
progressView.Show();
vm.OkCommand.IsExecutable = false;
vm.CancelCommand.IsExecutable = true;
try
{
await Task.Factory.StartNew(() =>
{
vm.startDownload(outputPath, items);
}, vm.CancellationToken);
}
catch (Exception)
{
}
vm.OkCommand.IsExecutable = true;
vm.CancelCommand.IsExecutable = false;
});
SettingsViewModel = (ImageSearchSettingsViewModel)ServiceLocator.Current.GetInstance(typeof(ImageSearchSettingsViewModel));
Size = new ListCollectionView(size);
Size.MoveCurrentTo(Settings.Default.Size);
SafeSearch = new ListCollectionView(safeSearch);
SafeSearch.MoveCurrentTo(Settings.Default.SafeSearch);
Layout = new ListCollectionView(layout);
Layout.MoveCurrentTo(Settings.Default.Layout);
Type = new ListCollectionView(type);
Type.MoveCurrentTo(Settings.Default.Type);
People = new ListCollectionView(people);
People.MoveCurrentTo(Settings.Default.People);
Color = new ListCollectionView(color);
Color.MoveCurrentTo(Settings.Default.Color);
GeoTag = new GeoTagCoordinatePair();
MediaState = new MediaState();
MediaStateCollectionView = new ImageResultCollectionView(MediaState);
MediaStateCollectionView.MediaState.MediaStateType = MediaStateType.SearchResult;
WeakEventManager<MediaLockedCollection, EventArgs>.AddHandler(MediaStateCollectionView.MediaState.UIMediaCollection, "IsLoadingChanged", mediaCollection_IsLoadingChanged);
}
示例10: 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);
}