public void CanSort_Returns_False() { int[] source = new[] { 1, 1, 2, 3, 5, 8 }; CollectionView target = new CollectionView(source); Assert.IsFalse(target.CanSort); }
public CustomListbox(ref CollectionView iBindableView) { InitializeComponent(); pBindableView = iBindableView; OnPropertyChanged("dataView"); }
public void Culture_Is_Initially_Null() { int[] source = new[] { 1, 1, 2, 3, 5, 8 }; CollectionView target = new CollectionView(source); Assert.IsNull(target.Culture); }
public void Initial_Items_Are_Same_As_SourceCollection() { int[] source = new[] { 1, 1, 2, 3, 5, 8 }; CollectionView target = new CollectionView(source); CollectionAssert.AreEqual(source, ((IEnumerable)target).Cast<object>().ToArray()); }
public void CanFilter_Returns_True() { int[] source = new[] { 1, 1, 2, 3, 5, 8 }; CollectionView target = new CollectionView(source); Assert.IsTrue(target.CanFilter); }
public void SourceCollection_Is_Set() { int[] source = new[] { 1, 1, 2, 3, 5, 8 }; CollectionView target = new CollectionView(source); Assert.AreSame(source, target.SourceCollection); }
public ResGroupEditor(IEditorEnvironment editorEnvironment, ICommandHistory history) { this.editorEnvironment = editorEnvironment; this.history = history; this.AutoSize = true; this.Padding = new Padding(10); this.SuspendLayout(); this.split = new SplitContainer { Dock = DockStyle.Fill }; this.split.Panel2Collapsed = true; this.Controls.Add(this.split); var sp = new StackPanel { Dock = DockStyle.Fill, AutoSize = true }; this.split.Panel1.Controls.Add(sp); var collectionView = new CollectionView<IResourceFile>(a => editorEnvironment.EditorFor(a, history)) { AutoSize = true }; collectionView.ItemsPanel.AutoSize = true; collectionView.ItemsPanel.AutoScroll = false; new PropertyBinding<ResGroup, IList<IResourceFile>>(collectionView, this.dataContext, m => m.ExternalResources, null); sp.Controls.Add(collectionView); var embCollectionView = new CollectionView<Managed>(a => this.CreateButtonForResource(a)) { AutoSize = true }; embCollectionView.ItemsPanel.AutoSize = true; embCollectionView.ItemsPanel.AutoScroll = false; new PropertyBinding<ResGroup, IList<Managed>>(embCollectionView, this.dataContext, m => m.EmbeddedResources, null); sp.Controls.Add(embCollectionView); this.ResumeLayout(); this.PerformLayout(); }
internal static CustomItemContainerGenerator CreateGenerator( DataGridControl parentGridControl, CollectionView collectionView, DataGridContext dataGridContext ) { CustomItemContainerGenerator newGenerator = new CustomItemContainerGenerator( collectionView, dataGridContext, parentGridControl ); dataGridContext.SetGenerator( newGenerator ); return newGenerator; }
public ConnectionViewModel(string name) { _name = name; IList<PhoneBookEntry> list = new List<PhoneBookEntry> { new PhoneBookEntry("test"), new PhoneBookEntry("test2") }; _phonebookEntries = new CollectionView(list); }
private void AddGrouping(object sender, RoutedEventArgs e) { _myView = (CollectionView) CollectionViewSource.GetDefaultView(myItemsControl.ItemsSource); if (_myView.CanGroup) { var groupDescription = new PropertyGroupDescription("@Type"); _myView.GroupDescriptions.Add(groupDescription); } }
public MainWindowViewModel() { Properties.Settings.Default.LastLogReadedDate = DateTime.Now; IsAutostart = Properties.Settings.Default.Autostart; MailStateButtonName = "Active Mail Service"; AvailableDriveLetters = new CollectionView(GetAvailableDrives()); _alarmTimer = new DispatcherTimer(); _alarmTimer.Tick += new EventHandler(SendMailTick); _alarmTimer.Interval = TimeSpan.FromMinutes(Properties.Settings.Default.AlarmIntervalInMinutes); }
public LogViewModel() { MessagesLock = new Object(); messages = new ObservableCollection<LogMessageModel>(); BindingOperations.EnableCollectionSynchronization(messages, MessagesLock); //clearLog = new Command(new Action(() => messages.Clear())); LogLevel = new CollectionView(Enum.GetValues(typeof(LogMessageModel.LogLevel))); LogLevel.MoveCurrentTo(LogMessageModel.LogLevel.INFO); }
/// <summary> /// Initializes a new instance of the <see cref="ToolkitType"/> class. /// </summary> public ToolkitType() { var componentModel = ServiceProvider.GlobalProvider.GetService<SComponentModel, IComponentModel>(); var export = componentModel.GetService<IEnumerable<IInstalledToolkitInfo>>(); this.allToolkits = new ObservableCollection<IInstalledToolkitInfo>((export != null) ? export.ToList() : new List<IInstalledToolkitInfo>()); this.toolkitsView = new ListCollectionView(this.allToolkits); InitializeComponent(); FilterToolkits(); }
public MainWindowViewModel(Window window) { this.CurrentWindow = window; this._allStudents = DBHandler.Instance.QueryAll(); this._filteredStudents = new StudentCollection(); this.Students = this._allStudents; IList<SearchConditionEntry> searchConditionList = new List<SearchConditionEntry>(); searchConditionList.Add(new SearchConditionEntry("姓名", SearchCategory.SearchByName)); searchConditionList.Add(new SearchConditionEntry("身份证", SearchCategory.SearchByIdentity)); this._searchConditions = new CollectionView(searchConditionList); this._searchKeyword = ""; }
public CurrencyManager( DataGridContext dataGridContext, CollectionView collectionView ) { if( dataGridContext == null ) throw new ArgumentNullException( "dataGridContext" ); if( collectionView == null ) throw new ArgumentNullException( "collectionView" ); m_dataGridContext = dataGridContext; m_collectionView = collectionView; System.Diagnostics.Debug.Assert( m_dataGridContext.CurrentItem == m_collectionView.CurrentItem ); this.RegisterListeners(); }
public ButtonMappingEntryControl() { ButtonProfile = new DsButtonProfile(); InitializeComponent(); CurrentCommandTypeView = new CollectionView(AvailableCommandTypes); CurrentCommandTargetView = new CollectionView(AvailableKeys); CurrentCommandTypeView.MoveCurrentTo(AvailableCommandTypes.First()); CurrentCommandTargetView.MoveCurrentTo(AvailableKeys.First()); CurrentCommandTypeView.CurrentChanged += CurrentCommandTypeOnCurrentChanged; CurrentCommandTargetView.CurrentChanged += CurrentCommandTargetOnCurrentChanged; }
public MainWindow() { InitializeComponent(); panel.DataContext = staff; staff.Add(new Staff { FileName = "atm.jpg", FullName = "Arne Tolstrup Madsen", Initials = "atm" }); staff.Add(new Staff { FileName = "tk.jpg", FullName = "Torben Krøjmand", Initials = "tk" }); staff.Add(new Staff { FileName = "kr.jpg", FullName = "Karsten Rasmussen", Initials = "kr" }); staff.Add(new Staff { FileName = "haso.jpg", FullName = "Hanne Sommer", Initials = "haso" }); staff.Add(new Staff { FileName = "gs.jpg", FullName = "Gert Simonsen", Initials = "gs" }); view = (CollectionView)CollectionViewSource.GetDefaultView(staff); // set biding for tBoxHeight Binding binding = new Binding(); binding.Path = new PropertyPath("FullName"); binding.Mode = BindingMode.OneWay; lbl.SetBinding(Label.ContentProperty, binding); binding = new Binding(); binding.Path = new PropertyPath("Initials"); binding.Mode = BindingMode.TwoWay; txbox.SetBinding(TextBox.TextProperty, binding); binding = new Binding(); binding.Path = new PropertyPath("FileName"); binding.Mode = BindingMode.OneWay; binding.Converter = new FileNameConverter(); img.SetBinding(Image.SourceProperty, binding); }
public MainWindow() { InitializeComponent(); // Preparing some fake data List<Person> people = new List<Person> { new Person {FirstName="Agnes", Age=30, FavoriteColor = "Black"}, new Person {FirstName = "Janne", Age=22, FavoriteColor = "Magenta"}, new Person {FirstName = "Roy", Age=23, FavoriteColor = "Aquamarine"}, new Person {FirstName = "Kimmel", Age=32, FavoriteColor = "Green"}, new Person {FirstName ="Manuel", Age=20, FavoriteColor = "Blue"} }; listPeople.ItemsSource = people; peopleCollectionView = CollectionViewSource.GetDefaultView(listPeople.ItemsSource) as CollectionView; }
public MainWindow() { InitializeComponent(); // Preparing some fake data List<Person> people = new List<Person> { new Person {FirstName="Agnes", Age=30, FavoriteColor = "Black", Gender="F"}, new Person {FirstName = "Janne", Age=22, FavoriteColor = "Black", Gender="M"}, new Person {FirstName = "Roy", Age=23, FavoriteColor = "Aquamarine", Gender="M"}, new Person {FirstName = "Kimmel", Age=32, FavoriteColor = "Green", Gender="M"}, new Person {FirstName ="Manuela", Age=20, FavoriteColor = "Green", Gender="F"} }; listPeople.ItemsSource = people; peopleCollectionView = CollectionViewSource.GetDefaultView(listPeople.ItemsSource) as CollectionView; peopleCollectionView.GroupDescriptions.Add(new PropertyGroupDescription(propertyName: "Gender")); peopleCollectionView.GroupDescriptions.Add(new PropertyGroupDescription(propertyName: "FavoriteColor")); }
private MessageHeaderViewModel selectedMessageHeaderViewModel; // This could be null. #endregion Fields #region Constructors public MessageListViewModel() { LoadMessages(); messageManager.NewMessageArrived += OnNewMessageArrived; messageManager.MessageAdded += OnMessageAdded; messageManager.MessageRemoved += OnMessageRemoved; MessageContentViewPopupRequest = new InteractionRequest<MessageContentViewNotification>(); OpenMessageContentViewCommand = new DelegateCommand(RaiseMessageContentViewPopupRequest); DeleteMessageCommand = new DelegateCommand(RaiseDeleteMessagesEvent); this.messagesCv = (CollectionView)CollectionViewSource.GetDefaultView(MessageHeaderViewModels); this.messagesCv.SortDescriptions.Add(new SortDescription("Date", ListSortDirection.Descending)); SelectedMessageHeaderViewModels = new List<MessageHeaderViewModel>(); HandleMailboxSelectionChange(null); GlobalEventAggregator.Instance.GetEvent<MailboxSelectionEvent>().Subscribe(HandleMailboxSelectionChange, ThreadOption.UIThread); GlobalEventAggregator.Instance.GetEvent<DeleteMessagesEvent>().Subscribe(HandleDeleteMessagesEvent, ThreadOption.UIThread); }
private void CurrentCommandTypeOnCurrentChanged(object sender, EventArgs eventArgs) { ButtonProfile.MappingTarget.CommandType = (CommandType) Enum.ToObject(typeof (CommandType), ((EnumMetaData) CurrentCommandTypeView.CurrentItem).Value); switch (ButtonProfile.MappingTarget.CommandType) { case CommandType.GamepadButton: CurrentCommandTargetView = new CollectionView(AvailableGamepadButtons); break; case CommandType.Keystrokes: CurrentCommandTargetView = new CollectionView(AvailableKeys); break; case CommandType.MouseButtons: CurrentCommandTargetView = new CollectionView(AvailableMouseButtons); break; } CurrentCommandTargetView.MoveCurrentToFirst(); CurrentCommandTargetView.CurrentChanged += CurrentCommandTargetOnCurrentChanged; }
public ButtonMappingViewModel(DsButtonProfile profile) { CurrentButtonProfile = profile; CurrentCommandTypeView = new CollectionView(AvailableCommandTypes); CurrentCommandTargetView = new CollectionView(AvailableKeys); CurrentCommandTypeView.MoveCurrentTo(AvailableCommandTypes.First()); CurrentCommandTargetView.MoveCurrentTo(AvailableKeys.First()); if (CurrentButtonProfile != null) { CurrentCommandTypeView.MoveCurrentTo(profile.MappingTarget.CommandType); CurrentCommandTargetView.MoveCurrentTo(profile.MappingTarget.CommandTarget); } else { CurrentButtonProfile = new DsButtonProfile(); } CurrentCommandTypeView.CurrentChanged += CurrentCommandTypeOnCurrentChanged; CurrentCommandTargetView.CurrentChanged += CurrentCommandTargetOnCurrentChanged; }
private void ValidateViewType(CollectionView cv, Type collectionViewType) { if (collectionViewType != null) { // If the view contained in the ViewTable is a proxy of another // view, then what we really want to compare is the type of that // other view. CollectionViewProxy cvp = cv as CollectionViewProxy; Type cachedViewType = (cvp == null) ? cv.GetType() : cvp.ProxiedView.GetType(); if (cachedViewType != collectionViewType) throw new ArgumentException(SR.Get(SRID.CollectionView_NameTypeDuplicity, collectionViewType, cachedViewType)); } }
private void InitProperties() { _yatse2Properties = TryFindResource("Yatse2Properties") as Yatse2Properties; _moviesDataSource = TryFindResource("MoviesDataSource") as MoviesCollection; _moviesCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_Movies_flow.ItemsSource); _tvShowsDataSource = TryFindResource("TvShowsDataSource") as TvShowsCollection; _tvShowsCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_TvShows_flow.ItemsSource); _tvSeasonsDataSource = TryFindResource("TvSeasonsDataSource") as TvSeasonsCollection; _tvSeasonsCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_TvSeasons_flow.ItemsSource); _tvEpisodesDataSource = TryFindResource("TvEpisodesDataSource") as TvEpisodesCollection; _tvEpisodesCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_TvEpisodes_flow.ItemsSource); _audioAlbumsDataSource = TryFindResource("AudioAlbumsDataSource") as AudioAlbumsCollection; _audioAlbumsCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_AudioAlbums_flow.ItemsSource); _audioArtistsDataSource = TryFindResource("AudioArtistsDataSource") as AudioArtistsCollection; _audioArtistsCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_AudioArtists_flow.ItemsSource); _audioGenresDataSource = TryFindResource("AudioGenresDataSource") as AudioGenresCollection; _audioGenresCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(lst_AudioGenres_flow.ItemsSource); _audioSongsDataSource = TryFindResource("AudioSongsDataSource") as AudioSongsCollection; _moviesCollectionView.Filter = new Predicate<object>(FilterMovies); _tvShowsCollectionView.Filter = new Predicate<object>(FilterTvShows); _audioAlbumsCollectionView.Filter = new Predicate<object>(FilterAudioAlbum); _audioArtistsCollectionView.Filter = new Predicate<object>(FilterAudioArtist); _audioGenresCollectionView.Filter = new Predicate<object>(FilterAudioGenre); }
public GridViewSource(UICollectionView collectionView) : base(collectionView, new NSString("GridViewCell")) { CollectionView.RegisterClassForCell(typeof(GridViewCell), DefaultCellIdentifier); ReloadOnAllItemsSourceSets = true; }
public ItemContentControl() { CollectionView.VerifyCollectionViewFlagEnabled(nameof(ItemContentControl)); DefaultStyleKey = typeof(ItemContentControl); }
public MainPage() { BackgroundColor = Color.PowderBlue; Title = "Notes"; BindingContext = new MainPageViewModel(); var xamagonImage = new Image { Source = "xamagon.png" }; var noteEditor = new Editor { Placeholder = "Enter Note", BackgroundColor = Color.White, Margin = new Thickness(10) }; noteEditor.SetBinding(Editor.TextProperty, nameof(MainPageViewModel.NoteText)); var saveButton = new Button { Text = "Save", TextColor = Color.White, BackgroundColor = Color.Green, Margin = new Thickness(10) }; saveButton.SetBinding(Button.CommandProperty, nameof(MainPageViewModel.SaveNoteCommand)); var deleteButton = new Button { Text = "Delete", TextColor = Color.White, BackgroundColor = Color.Red, Margin = new Thickness(10) }; deleteButton.SetBinding(Button.CommandProperty, nameof(MainPageViewModel.EraseNotesCommand)); var collectionView = new CollectionView { ItemTemplate = new NotesTemplate(), SelectionMode = SelectionMode.Single }; collectionView.SetBinding(CollectionView.ItemsSourceProperty, nameof(MainPageViewModel.Notes)); collectionView.SetBinding(CollectionView.SelectedItemProperty, nameof(MainPageViewModel.SelectedNote)); collectionView.SetBinding(CollectionView.SelectionChangedCommandProperty, nameof(MainPageViewModel.NoteSelectedCommand)); var grid = new Grid { Margin = new Thickness(20, 40), ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } }, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2.5, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2.0, GridUnitType.Star) }, } }; grid.Children.Add(xamagonImage, 0, 0); Grid.SetColumnSpan(xamagonImage, 2); grid.Children.Add(noteEditor, 0, 1); Grid.SetColumnSpan(noteEditor, 2); grid.Children.Add(saveButton, 0, 2); grid.Children.Add(deleteButton, 1, 2); grid.Children.Add(collectionView, 0, 3); Grid.SetColumnSpan(collectionView, 2); Content = grid; }
internal CollectionViewGroupRoot(CollectionView view) : base("Root", null) { _view = view; }
internal void DeleteItems(IEnumerable <int> positions) { var indices = positions.Select(o => NSIndexPath.FromRowSection(o, 0)).ToArray(); CollectionView.DeleteItems(indices); }
public void Dispose() { if (this._collectionView != null) { this._collectionView.EndDefer(); this._collectionView = null; } }
public override void Initialize() { base.Initialize(); if (App.CurrentAccount == null) { return; } AutomaticallyStartCheckBox.IsChecked = App.CurrentAccount.VideoAutomaticallyStart; AutomaticallyAcceptCheckBox.IsChecked = App.CurrentAccount.VideoAutomaticallyAccept; ShowSelfViewCheckBox.IsChecked = App.CurrentAccount.ShowSelfView; string accountPreset = App.CurrentAccount.VideoPreset; if (string.IsNullOrWhiteSpace(accountPreset)) { accountPreset = "default"; } foreach (var item in VideoPresetComboBox.Items) { var tb = item as TextBlock; string itemString = tb.Text; if (itemString.Equals(accountPreset)) { VideoPresetComboBox.SelectedItem = item; break; } } float preferredFPS = App.CurrentAccount.PreferredFPS; PreferredFPSTextBox.Text = Convert.ToString(preferredFPS); VideoCodecsListView.ItemsSource = App.CurrentAccount.VideoCodecsList; _codecsView = (CollectionView)CollectionViewSource.GetDefaultView(VideoCodecsListView.ItemsSource); if (_codecsView != null) { _codecsView.SortDescriptions.Add(new SortDescription("Priority", ListSortDirection.Ascending)); _codecsView.Refresh(); } /* * New option name: RTCP feedback * Option Location: Advanced > Video * Options: Implicit, Explicit, Off * Default: "Implicit" * * AVPF shall be off by default and "rtcp_fb_implicit_rtcp_fb" on =1 call that combination "RTCP feedback (AVPF)" (Implicit) * and then a setting with both AVPF off and "rtcp_fb_implicit_rtcp_fb" off , and call that setting "RTCP feedback (AVPF)" (Off) * And a setting with both AVPF on and "rtcp_fb_implicit_rtcp_fb" on , and call that setting "RTCP feedback (AVPF)" (Explicit). * The function can be activated/deactivated via an integer parameter called "rtcp_fb_implicit_rtcp_fb" inside "rtp" section. Values are 0 or 1. * This parameter can be set dynamically also via the traditional wrappers to get/set parameters (lp_config_set_int for C API). * Default value = 1 * */ string rtcpFeedbackString = ServiceManager.Instance.ConfigurationService.Get(Configuration.ConfSection.GENERAL, Configuration.ConfEntry.RTCP_FEEDBACK, "Off"); foreach (var item in RtcpFeedbackComboBox.Items) { var tb = item as TextBlock; if (tb.Text.Equals(rtcpFeedbackString)) { RtcpFeedbackComboBox.SelectedItem = item; break; } } }
public virtual void UpdateItemsSource() { ItemsSource = CreateItemsViewSource(); CollectionView.ReloadData(); CollectionView.CollectionViewLayout.InvalidateLayout(); }
private CustomItemContainerGenerator( CollectionView collectionView, DataGridContext dataGridContext, DataGridControl gridControl ) { if( collectionView == null ) { throw new ArgumentNullException( "collectionView" ); } if( dataGridContext == null ) { throw new ArgumentNullException( "dataGridContext" ); } if( gridControl == null ) { throw new ArgumentNullException( "gridControl" ); } m_dataGridControl = gridControl; m_dataGridContext = dataGridContext; m_collectionView = collectionView; IList listInterface = m_collectionView as IList; if( listInterface == null ) { listInterface = m_collectionView.SourceCollection as IList; } m_listInterface = listInterface; //initialize explicitly (set a local value) to the DataItem attached property (for nested DataGridControls) CustomItemContainerGenerator.SetDataItemProperty( m_dataGridControl, CustomItemContainerGenerator.NotSet ); //Notify to the ItemCollection CollectionChanged event. CollectionChangedEventManager.AddListener( m_collectionView, this ); //Notify to the DataGridControl's or DetailConfiguration GroupConfigurationSelector Changed event. GroupConfigurationSelectorChangedEventManager.AddListener( m_dataGridContext, this ); CollectionChangedEventManager.AddListener( m_dataGridContext.DetailConfigurations, this ); // It would have been neat to create a DependencyPropertyChangedEventManager but the // WeakEventManager was not made to work with DependencyPropertyDescriptor.AddValueChanged. //identifies a Master generator if( m_dataGridContext.SourceDetailConfiguration == null ) { ItemsSourceChangeCompletedEventManager.AddListener( m_dataGridControl, this ); ViewChangedEventManager.AddListener( m_dataGridControl, this ); ThemeChangedEventManager.AddListener( m_dataGridControl, this ); } m_nodeFactory = new GeneratorNodeFactory( this.OnGeneratorNodeItemsCollectionChanged, this.OnGeneratorNodeGroupsCollectionChanged, this.OnGeneratorNodeExpansionStateChanged, this.OnGroupGeneratorNodeIsExpandedChanging, this.OnGroupGeneratorNodeIsExpandedChanged ); m_headerFooterDataContextBinding = new Binding(); m_headerFooterDataContextBinding.Source = m_dataGridControl; m_headerFooterDataContextBinding.Path = new PropertyPath( DataGridControl.DataContextProperty ); this.ResetNodeList(); this.IncrementCurrentGenerationCount(); }
/// <summary> /// Show list game with achievement. /// </summary> public void GetListGame() { List <Guid> ListEmulators = new List <Guid>(); foreach (var item in PlayniteApi.Database.Emulators) { ListEmulators.Add(item.Id); } if (ListGames.Count == 0) { foreach (var item in PlayniteApiDatabase.Games) { string GameSourceName = ""; if (item.SourceId != Guid.Parse("00000000-0000-0000-0000-000000000000")) { GameSourceName = item.Source.Name; if (item.PlayAction != null && item.PlayAction.EmulatorId != null && ListEmulators.Contains(item.PlayAction.EmulatorId)) { GameSourceName = "RetroAchievements"; } } else { if (item.PlayAction != null && item.PlayAction.EmulatorId != null && ListEmulators.Contains(item.PlayAction.EmulatorId)) { GameSourceName = "RetroAchievements"; } else { GameSourceName = "Playnite"; } } if (AchievementsDatabase.HaveAchievements(item.Id)) { if (AchievementsDatabase.VerifToAddOrShow(GameSourceName, settings, PluginUserDataPath)) { string GameId = item.Id.ToString(); string GameName = item.Name; string GameIcon; DateTime?GameLastActivity = null; string SourceName = ""; if (item.SourceId != Guid.Parse("00000000-0000-0000-0000-000000000000")) { SourceName = item.Source.Name; if (item.PlayAction != null && item.PlayAction.EmulatorId != null && ListEmulators.Contains(item.PlayAction.EmulatorId)) { SourceName = "RetroAchievements"; } } else { if (item.PlayAction != null && item.PlayAction.EmulatorId != null && ListEmulators.Contains(item.PlayAction.EmulatorId)) { SourceName = "RetroAchievements"; } else { SourceName = "Playnite"; } } GameAchievements GameAchievements = AchievementsDatabase.Get(item.Id); if (item.LastActivity != null) { GameLastActivity = ((DateTime)item.LastActivity).ToLocalTime(); } BitmapImage iconImage = new BitmapImage(); if (String.IsNullOrEmpty(item.Icon) == false) { iconImage.BeginInit(); GameIcon = PlayniteApiDatabase.GetFullFilePath(item.Icon); iconImage.UriSource = new Uri(GameIcon, UriKind.RelativeOrAbsolute); iconImage.EndInit(); } ListGames.Add(new ListGames() { Id = GameId, Name = GameName, Icon = iconImage, LastActivity = GameLastActivity, SourceName = SourceName, SourceIcon = TransformIcon.Get(SourceName), ProgressionValue = GameAchievements.Progression, Total = GameAchievements.Total, TotalPercent = GameAchievements.Progression + "%", Unlocked = GameAchievements.Unlocked }); iconImage = null; } } } } ListviewGames.ItemsSource = ListGames; // Filter if (!TextboxSearch.Text.IsNullOrEmpty() && SearchSources.Count != 0) { ListviewGames.ItemsSource = ListGames.FindAll( x => x.Name.ToLower().IndexOf(TextboxSearch.Text) > -1 && SearchSources.Contains(x.SourceName) ); return; } if (!TextboxSearch.Text.IsNullOrEmpty()) { ListviewGames.ItemsSource = ListGames.FindAll( x => x.Name.ToLower().IndexOf(TextboxSearch.Text) > -1 ); return; } if (SearchSources.Count != 0) { ListviewGames.ItemsSource = ListGames.FindAll( x => SearchSources.Contains(x.SourceName) ); return; } // Sorting try { var columnBinding = _lastHeaderClicked.Column.DisplayMemberBinding as Binding; var sortBy = columnBinding?.Path.Path ?? _lastHeaderClicked.Column.Header as string; // Specific sort with another column if (_lastHeaderClicked.Name == "lvSourceIcon") { columnBinding = lvSourceName.Column.DisplayMemberBinding as Binding; sortBy = columnBinding?.Path.Path ?? _lastHeaderClicked.Column.Header as string; } if (_lastHeaderClicked.Name == "lvProgression") { columnBinding = lvProgressionValue.Column.DisplayMemberBinding as Binding; sortBy = columnBinding?.Path.Path ?? _lastHeaderClicked.Column.Header as string; } Sort(sortBy, _lastDirection); } // If first view catch { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ListviewGames.ItemsSource); switch (settings.NameSorting) { case ("Name"): _lastHeaderClicked = lvName; if (settings.IsAsc) { _lastHeaderClicked.Content += " ▲"; } else { _lastHeaderClicked.Content += " ▼"; } break; case ("LastActivity"): _lastHeaderClicked = lvLastActivity; if (settings.IsAsc) { _lastHeaderClicked.Content += " ▲"; } else { _lastHeaderClicked.Content += " ▼"; } break; case ("SourceName"): _lastHeaderClicked = lvSourceIcon; if (settings.IsAsc) { lvSourceIcon.Content += " ▲"; } else { lvSourceIcon.Content += " ▼"; } break; case ("ProgressionValue"): _lastHeaderClicked = lvProgression; if (settings.IsAsc) { lvProgression.Content += " ▲"; } else { lvProgression.Content += " ▼"; } break; } if (settings.IsAsc) { _lastDirection = ListSortDirection.Ascending; } else { _lastDirection = ListSortDirection.Descending; } view.SortDescriptions.Add(new SortDescription(settings.NameSorting, _lastDirection)); } }
/// <summary> /// Wait for all animations to finish /// </summary> public async Task WaitAnimationsCompletedAsync() { await CollectionView.PerformBatchUpdatesAsync(() => { }); }
public ObservableMultiItemCollectionViewGallery(ItemsLayoutOrientation orientation = ItemsLayoutOrientation.Vertical, bool grid = true, int initialItems = 1000, bool withIndex = false) { var layout = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Star } } }; var itemsLayout = grid ? new GridItemsLayout(3, orientation) : new LinearItemsLayout(orientation) as IItemsLayout; var itemTemplate = ExampleTemplates.PhotoTemplate(); var collectionView = new CollectionView { ItemsLayout = itemsLayout, ItemTemplate = itemTemplate, AutomationId = "collectionview" }; var generator = new ItemsSourceGenerator(collectionView, initialItems, ItemsSourceType.MultiTestObservableCollection); var remover = new MultiItemRemover(collectionView, withIndex); var adder = new MultiItemAdder(collectionView, withIndex); var replacer = new MultiItemReplacer(collectionView); var mover = new MultiItemMover(collectionView); layout.Children.Add(generator); layout.Children.Add(remover); Grid.SetRow(remover, 1); layout.Children.Add(adder); Grid.SetRow(adder, 2); layout.Children.Add(replacer); Grid.SetRow(replacer, 3); layout.Children.Add(mover); Grid.SetRow(mover, 4); layout.Children.Add(collectionView); Grid.SetRow(collectionView, 5); Content = layout; generator.GenerateItems(); }
/// <summary> /// Provides a secure method for setting the DockableContents property. /// This dependency property indicates dockable contents hosted in parent <see cref="DockingManager"/> object. /// </summary> /// <param name="value">The new value for the property.</param> protected void SetDockableContents(CollectionView value) { SetValue(DockableContentsPropertyKey, value); }
private void ScrollToCenter(int position) { CollectionView.ScrollToPosition(position); }
/* ************************************************************************************************************************ *************************************************************************************************************************/ protected void passFolderContents(out CollectionView guiContentsCollectionView) { guiContentsCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(workingDirectory.contents); }
public async Task LoadMods() { var versionLoadSuccess = await MainWindow.Instance.VersionLoadStatus.Task; if (versionLoadSuccess == false) { return; } await _modsLoadSem.WaitAsync(); try { MainWindow.Instance.InstallButton.IsEnabled = false; MainWindow.Instance.GameVersionsBox.IsEnabled = false; MainWindow.Instance.InfoButton.IsEnabled = false; if (ModsList != null) { Array.Clear(ModsList, 0, ModsList.Length); } if (AllModsList != null) { Array.Clear(AllModsList, 0, AllModsList.Length); } InstalledMods = new List <Mod>(); CategoryNames = new List <string>(); ModList = new List <ModListItem>(); ModsListView.Visibility = Visibility.Hidden; if (App.CheckInstalledMods) { MainWindow.Instance.MainText = $"{FindResource("Mods:CheckingInstalledMods")}..."; await Task.Run(async() => await CheckInstalledMods()); InstalledColumn.Width = double.NaN; UninstallColumn.Width = 70; DescriptionColumn.Width = 750; } else { InstalledColumn.Width = 0; UninstallColumn.Width = 0; DescriptionColumn.Width = 800; } MainWindow.Instance.MainText = $"{FindResource("Mods:LoadingMods")}..."; await Task.Run(async() => await PopulateModsList()); ModsListView.ItemsSource = ModList; view = (CollectionView)CollectionViewSource.GetDefaultView(ModsListView.ItemsSource); PropertyGroupDescription groupDescription = new PropertyGroupDescription("Category"); view.GroupDescriptions.Add(groupDescription); this.DataContext = this; RefreshModsList(); ModsListView.Visibility = ModList.Count == 0 ? Visibility.Hidden : Visibility.Visible; NoModsGrid.Visibility = ModList.Count == 0 ? Visibility.Visible : Visibility.Hidden; MainWindow.Instance.MainText = $"{FindResource("Mods:FinishedLoadingMods")}."; MainWindow.Instance.InstallButton.IsEnabled = ModList.Count != 0; MainWindow.Instance.GameVersionsBox.IsEnabled = true; } finally { _modsLoadSem.Release(); } }
public ObservableCodeCollectionViewGallery(ItemsLayoutOrientation orientation = ItemsLayoutOrientation.Vertical, bool grid = true, int initialItems = 1000, bool addItemsWithTimer = false, ItemsUpdatingScrollMode scrollMode = ItemsUpdatingScrollMode.KeepItemsInView) { var layout = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Star } } }; IItemsLayout itemsLayout = grid ? new GridItemsLayout(3, orientation) : new LinearItemsLayout(orientation) as IItemsLayout; var itemTemplate = ExampleTemplates.PhotoTemplate(); var collectionView = new CollectionView { ItemsLayout = itemsLayout, ItemTemplate = itemTemplate, AutomationId = "collectionview", Header = "This is the header", ItemsUpdatingScrollMode = scrollMode }; var generator = new ItemsSourceGenerator(collectionView, initialItems, ItemsSourceType.ObservableCollection); var remover = new ItemRemover(collectionView); var adder = new ItemAdder(collectionView); var replacer = new ItemReplacer(collectionView); var mover = new ItemMover(collectionView); var inserter = new ItemInserter(collectionView); layout.Children.Add(generator); layout.Children.Add(remover); Grid.SetRow(remover, 1); layout.Children.Add(adder); Grid.SetRow(adder, 2); layout.Children.Add(replacer); Grid.SetRow(replacer, 3); layout.Children.Add(mover); Grid.SetRow(mover, 4); layout.Children.Add(inserter); Grid.SetRow(inserter, 5); layout.Children.Add(collectionView); Grid.SetRow(collectionView, 6); Content = layout; if (addItemsWithTimer) { generator.GenerateEmptyObservableCollectionAndAddItemsEverySecond(); } else { generator.GenerateItems(); } }
public void OffsetIndexBasedOnSourceNewIndex(int maxOffset) { if (m_dataGridContext == null) { throw new InvalidOperationException("We must have a DataGridContext to find the new index."); } CollectionView sourceItems = m_dataGridContext.Items; for (int i = this.Count - 1; i >= 0; i--) { SelectionRangeWithItems rangeWithItems = m_list[i]; object[] items = rangeWithItems.Items; if (items == null) { throw new InvalidOperationException("We should have items to find the new index."); } object item = items[0]; SelectionRange range = rangeWithItems.Range; int startIndex = Math.Min(range.StartIndex, range.EndIndex); if (maxOffset < 0) { for (int j = 0; j >= maxOffset; j--) { if (object.Equals(sourceItems.GetItemAt(startIndex), item)) { if (j != 0) { SelectionRange newRange = new SelectionRange(range.StartIndex + j, range.EndIndex + j); m_list[i] = new SelectionRangeWithItems(newRange, items); } break; } startIndex--; if (startIndex < 0) { break; } } } else { int sourceItemCount = sourceItems.Count; for (int j = 0; j <= maxOffset; j++) { if (object.Equals(sourceItems.GetItemAt(startIndex), item)) { if (j != 0) { SelectionRange newRange = new SelectionRange(range.StartIndex + j, range.EndIndex + j); m_list[i] = new SelectionRangeWithItems(newRange, items); } break; } startIndex++; if (startIndex >= sourceItemCount) { break; } } } } }
public TKInputViewModel() { taikhoan tk = new taikhoan(); var userinfo = DataProvider.Ins.DB.Users.Where(x => x.UserName == tk.UserName && x.IdRole == 1); List = new ObservableCollection <Model.InputInfo>(DataProvider.Ins.DB.InputInfoes); _EndDate = today; _StartDate = startdate; Grouping(); #region Search SearchCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadInputInfo(); }); #endregion #region Delete DeleteCommand = new RelayCommand <object>((p) => { if (SelectedItem == null || userinfo.Count() == 0) { return(false); } return(true); }, (p) => { if (MessageBox.Show("Bạn có thật sự muốn xóa?", "Thông báo", MessageBoxButton.OKCancel, MessageBoxImage.Warning) != MessageBoxResult.OK) { return; } else { string idinput = SelectedItem.IdInput; var inputs = DataProvider.Ins.DB.InputInfoes.Where(x => x.IdInput == SelectedItem.IdInput); if (inputs.Count() == 1) { var delete = DataProvider.Ins.DB.InputInfoes.Where(x => x.Id == SelectedItem.Id).SingleOrDefault(); var input = DataProvider.Ins.DB.Inputs.Where(x => x.Id == idinput); DataProvider.Ins.DB.InputInfoes.Remove(delete); DataProvider.Ins.DB.Inputs.Remove(input.SingleOrDefault()); DataProvider.Ins.DB.SaveChanges(); List.Remove(delete); MessageBox.Show("Bạn đã xóa thành công"); } else { var delete = DataProvider.Ins.DB.InputInfoes.Where(x => x.Id == SelectedItem.Id).SingleOrDefault(); DataProvider.Ins.DB.InputInfoes.Remove(delete); DataProvider.Ins.DB.SaveChanges(); List.Remove(delete); MessageBox.Show("Bạn đã xóa thành công"); } } }); #endregion #region Excel ExportExcelCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { ExportExcel(); }); #endregion #region Sort SortObjectDisplayNameCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(List); if (IsSort) { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); } else { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); } IsSort = !IsSort; }); SortIdCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(List); if (IsSort) { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Id", ListSortDirection.Ascending)); } else { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Id", ListSortDirection.Descending)); } IsSort = !IsSort; }); SortDateInputCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(List); if (IsSort) { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Input.DateInput", ListSortDirection.Ascending)); } else { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Input.DateInput", ListSortDirection.Descending)); } IsSort = !IsSort; }); SortCountCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(List); if (IsSort) { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Count", ListSortDirection.Ascending)); } else { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Count", ListSortDirection.Descending)); } IsSort = !IsSort; }); SortInputPriceCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(List); if (IsSort) { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("InputPrice", ListSortDirection.Ascending)); } else { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("InputPrice", ListSortDirection.Descending)); } IsSort = !IsSort; }); SortStatusCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(List); if (IsSort) { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Status", ListSortDirection.Ascending)); } else { //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); view.SortDescriptions.Clear(); view.SortDescriptions.Add(new SortDescription("Status", ListSortDirection.Descending)); } IsSort = !IsSort; }); #endregion }
public static void UpdateSelectionRangeWithItemsFromAdd( DataGridContext dataGridContext, SelectionRangeWithItems newRangeWithItems, ref SelectionRangeWithItems lastRangeWithItems) { // Only work for adding at the end of an existing range. object[] newRangeItems = newRangeWithItems.Items; if (((dataGridContext == null) || ((dataGridContext.ItemsSourceCollection == null) && (newRangeItems == null)) || (dataGridContext.ItemsSourceCollection is DataGridVirtualizingCollectionViewBase))) { lastRangeWithItems = new SelectionRangeWithItems( new SelectionRange(lastRangeWithItems.Range.StartIndex, newRangeWithItems.Range.EndIndex), null); return; } object[] rangeToUpdateItems = lastRangeWithItems.Items; object[] newItems; int newItemsStartPosition; if (newRangeWithItems == lastRangeWithItems) { if (newRangeItems != null) { return; } newItemsStartPosition = 0; newItems = new object[lastRangeWithItems.Length]; } else { newItemsStartPosition = lastRangeWithItems.Length; newItems = new object[lastRangeWithItems.Length + newRangeWithItems.Length]; Array.Copy(rangeToUpdateItems, newItems, newItemsStartPosition); } CollectionView items = (dataGridContext == null) ? null : dataGridContext.Items; int rangeToUpdateStartIndex = lastRangeWithItems.Range.StartIndex; int rangeToUpdateEndIndex = lastRangeWithItems.Range.EndIndex; int newRangeStartIndex = newRangeWithItems.Range.StartIndex; int newRangeEndIndex = newRangeWithItems.Range.EndIndex; // If new range have no items set, found the items and set it. if (newRangeItems == null) { if (newRangeEndIndex > newRangeStartIndex) { for (int i = newRangeStartIndex; i <= newRangeEndIndex; i++) { newItems[newItemsStartPosition] = items.GetItemAt(i); newItemsStartPosition++; } } else { for (int i = newRangeStartIndex; i >= newRangeEndIndex; i--) { newItems[newItemsStartPosition] = items.GetItemAt(i); newItemsStartPosition++; } } } else { for (int i = 0; i < newRangeItems.Length; i++) { newItems[newItemsStartPosition] = newRangeItems[i]; newItemsStartPosition++; } } lastRangeWithItems = new SelectionRangeWithItems( new SelectionRange(rangeToUpdateStartIndex, newRangeEndIndex), newItems); }
private void CheckData_Filters() { try { CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(DataGrid_1.ItemsSource); itemsViewOriginal.Filter = ((o) => { bool UniqueID = false; if (String.IsNullOrEmpty(SearchBox_Unique_id.Text) || ((CarProduct)o).unique_id.ToLower().Contains(SearchBox_Unique_id.Text.ToLower())) { UniqueID = true; } bool Title = false; if (String.IsNullOrEmpty(SearchBox_Title.Text) || ((CarProduct)o).title.ToLower().Contains(SearchBox_Title.Text.ToLower())) { Title = true; } bool Description = false; if (String.IsNullOrEmpty(SearchBox_Description.Text) || ((CarProduct)o).description.ToLower().Contains(SearchBox_Description.Text.ToLower())) { Description = true; } bool Category = false; if (String.IsNullOrEmpty((String)Textcategory_id.Content) || ((CarProduct)o).category_id == Textcategory_id.Content.ToString()) { Category = true; } bool Price = false; if (((CarProduct)o).price >= RangeCarPrice.LowerValue && ((CarProduct)o).price <= RangeCarPrice.HigherValue) { Price = true; } bool Amount = false; if (((CarProduct)o).amount >= RangeCarAmount.LowerValue && ((CarProduct)o).amount <= RangeCarAmount.HigherValue) { Amount = true; } bool Make = false; if (String.IsNullOrEmpty(SearchBox_Make.Text) || ((CarProduct)o).make_name == SearchBox_Make.Text) { Make = true; } bool Model = false; if (String.IsNullOrEmpty(SearchBox_Model.Text) || ((CarProduct)o).model_name == SearchBox_Model.Text) { Model = true; } bool Color = false; if (String.IsNullOrEmpty(SearchBox_Color.Text) || ((CarProduct)o).color == SearchBox_Color.Text) { Color = true; } bool Cargrbool = false; if (CheckboxCar.IsChecked ?? false) { if (((CarProduct)o).isParent == "ΝΑΙ") { Cargrbool = true; } } else { Cargrbool = true; } if (UniqueID && Title && Description && Category && Price && Amount && Make && Model && Cargrbool && Color) { return(true); } else { return(false); } }); itemsViewOriginal.Refresh(); } catch (Exception) { return; } }
public virtual void UpdateItemsSource() { _itemsSource = ItemsSourceFactory.Create(_itemsView.ItemsSource, CollectionView); CollectionView.ReloadData(); CollectionView.CollectionViewLayout.InvalidateLayout(); }
private void SetMainPage() { var appBar = new AppBar() { Title = "NUI Tizen Gallery", AutoNavigationContent = false, }; var appBarStyle = ThemeManager.GetStyle("Tizen.NUI.Components.AppBar"); var moreButton = new Button(((AppBarStyle)appBarStyle).BackButton); moreButton.Icon.ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "menu.png"; appBar.NavigationContent = moreButton; var pageContent = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; field = new SearchField() { WidthSpecification = LayoutParamPolicies.MatchParent, }; field.SearchButton.Clicked += OnSearchBtnClicked; testSource = new GalleryViewModel().CreateData(); selMode = ItemSelectionMode.SingleAlways; var myTitle = new DefaultTitleItem() { Text = "TestCase", WidthSpecification = LayoutParamPolicies.MatchParent, }; colView = new CollectionView() { ItemsSource = testSource, ItemsLayouter = new LinearLayouter(), ItemTemplate = new DataTemplate(() => { DefaultLinearItem item = new DefaultLinearItem() { WidthSpecification = LayoutParamPolicies.MatchParent, }; item.Label.SetBinding(TextLabel.TextProperty, "ViewLabel"); item.Label.HorizontalAlignment = HorizontalAlignment.Begin; return(item); }), Header = myTitle, ScrollingDirection = ScrollableBase.Direction.Vertical, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, SelectionMode = selMode, }; colView.SelectionChanged += OnSelectionChanged; pageContent.Add(field); pageContent.Add(colView); page = new ContentPage() { AppBar = appBar, Content = pageContent, }; navigator.Push(page); }
private void UpdateItemsView() { _logView = CollectionViewSource.GetDefaultView(LogItems) as CollectionView; _logView.Filter = new Predicate <object>(MessageFilter); dataGrid1.ItemsSource = _logView; }
public void sortByDate() { CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listView.ItemsSource); view.SortDescriptions.Add(new SortDescription("CreationDate", ListSortDirection.Ascending)); }
public AddFoodPageViewModel(int numberOfMeal, MainPageViewModel mainPageViewModel, CollectionView collectionView, Entry entry) { _numberOfMeal = numberOfMeal; _mainPageViewModel = mainPageViewModel; _collectionViewCollection = collectionView; _mainEntry = entry; SearchButtonClick = new Command(async() => await SearchButtonClickImpl()); OnSelectedCommand = new Command(OnSelectedCommandImpl); }
private ViewRecord CacheView(object collection, CollectionViewSource cvs, CollectionView cv, ViewRecord vr) { // create the view table, if necessary ViewTable vt = this[collection]; if (vt == null) { vt = new ViewTable(); Add(collection, vt); // if the collection doesn't implement INCC, it won't hold a strong // reference to its views. To mitigate Dev10 bug 452676, keep a // strong reference to the ViewTable alive for at least a few // Purge cycles. (See comment at the top of the file.) if (!(collection is INotifyCollectionChanged)) { _inactiveViewTables.Add(vt, InactivityThreshold); } } // keep the view and the view table alive as long as any view // (or the collection itself) is alive if (vr == null) vr = new ViewRecord(cv); else if (cv == null) cv = (CollectionView)vr.View; cv.SetViewManagerData(vt); // add the view to the table vt[cvs] = vr; return vr; }
protected void UpdateCellConstraints() { PrepareCellsForLayout(CollectionView.VisibleCells); PrepareCellsForLayout(CollectionView.GetVisibleSupplementaryViews(UICollectionElementKindSectionKey.Header)); PrepareCellsForLayout(CollectionView.GetVisibleSupplementaryViews(UICollectionElementKindSectionKey.Footer)); }
private void RemoveGrouping(object sender, RoutedEventArgs e) { myView = (CollectionView)CollectionViewSource.GetDefaultView(myItemsControl.ItemsSource); myView.GroupDescriptions.Clear(); }
public MultiItemReplacer(CollectionView cv, bool withIndex = false) : base(cv, "Replace w/ 4 Items") { Entry.Keyboard = Keyboard.Default; _withIndex = withIndex; }
public ItemRemover(CollectionView cv) : base(cv, "Remove") { }
// Token: 0x060076F8 RID: 30456 RVA: 0x0021FCC8 File Offset: 0x0021DEC8 internal ViewRecord GetViewRecord(object collection, CollectionViewSource cvs, Type collectionViewType, bool createView, Func <object, object> GetSourceItem) { ViewRecord viewRecord = this.GetExistingView(collection, cvs, collectionViewType, GetSourceItem); if (viewRecord != null || !createView) { return(viewRecord); } IListSource listSource = collection as IListSource; IList list = null; if (listSource != null) { list = listSource.GetList(); viewRecord = this.GetExistingView(list, cvs, collectionViewType, GetSourceItem); if (viewRecord != null) { return(this.CacheView(collection, cvs, (CollectionView)viewRecord.View, viewRecord)); } } ICollectionView collectionView = collection as ICollectionView; if (collectionView != null) { collectionView = new CollectionViewProxy(collectionView); } else if (collectionViewType == null) { ICollectionViewFactory collectionViewFactory = collection as ICollectionViewFactory; if (collectionViewFactory != null) { collectionView = collectionViewFactory.CreateView(); } else { IList list2 = (list != null) ? list : (collection as IList); if (list2 != null) { IBindingList bindingList = list2 as IBindingList; if (bindingList != null) { collectionView = new BindingListCollectionView(bindingList); } else { collectionView = new ListCollectionView(list2); } } else { IEnumerable enumerable = collection as IEnumerable; if (enumerable != null) { collectionView = new EnumerableCollectionView(enumerable); } } } } else { if (!typeof(ICollectionView).IsAssignableFrom(collectionViewType)) { throw new ArgumentException(SR.Get("CollectionView_WrongType", new object[] { collectionViewType.Name })); } object obj = (list != null) ? list : collection; try { collectionView = (Activator.CreateInstance(collectionViewType, BindingFlags.CreateInstance, null, new object[] { obj }, null) as ICollectionView); } catch (MissingMethodException innerException) { throw new ArgumentException(SR.Get("CollectionView_ViewTypeInsufficient", new object[] { collectionViewType.Name, collection.GetType() }), innerException); } } if (collectionView != null) { CollectionView collectionView2 = collectionView as CollectionView; if (collectionView2 == null) { collectionView2 = new CollectionViewProxy(collectionView); } if (list != null) { viewRecord = this.CacheView(list, cvs, collectionView2, null); } viewRecord = this.CacheView(collection, cvs, collectionView2, viewRecord); BindingOperations.OnCollectionViewRegistering(collectionView2); } return(viewRecord); }
// Methods public DeferHelper(CollectionView collectionView) { this._collectionView = collectionView; }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); albumSource = new AlbumViewModel(); // Add test menu options. moveGroup.Add(moveMenu); albumSource.Insert(0, moveGroup); insertDeleteGroup.Add(insertMenu); insertDeleteGroup.Add(deleteMenu); albumSource.Insert(0, insertDeleteGroup); selMode = ItemSelectionMode.Single; DefaultTitleItem myTitle = new DefaultTitleItem(); //To Bind the Count property changes, need to create custom property for count. myTitle.Text = "Linear Sample Group[" + albumSource.Count + "]"; //Set Width Specification as MatchParent to fit the Item width with parent View. myTitle.WidthSpecification = LayoutParamPolicies.MatchParent; colView = new CollectionView() { ItemsSource = albumSource, ItemsLayouter = new LinearLayouter(), ItemTemplate = new DataTemplate(() => { DefaultLinearItem item = new DefaultLinearItem(); //Set Width Specification as MatchParent to fit the Item width with parent View. item.WidthSpecification = LayoutParamPolicies.MatchParent; //Decorate Label item.Label.SetBinding(TextLabel.TextProperty, "ViewLabel"); item.Label.HorizontalAlignment = HorizontalAlignment.Begin; //Decorate Icon item.Icon.SetBinding(ImageView.ResourceUrlProperty, "ImageUrl"); item.Icon.WidthSpecification = 80; item.Icon.HeightSpecification = 80; //Decorate Extra RadioButton. //[NOTE] This is sample of RadioButton usage in CollectionView. // RadioButton change their selection by IsSelectedProperty bindings with // SelectionChanged event with Single ItemSelectionMode of CollectionView. // be aware of there are no RadioButtonGroup. item.Extra = new RadioButton(); //FIXME : SetBinding in RadioButton crashed as Sensitive Property is disposed. //item.Extra.SetBinding(RadioButton.IsSelectedProperty, "Selected"); item.Extra.WidthSpecification = 80; item.Extra.HeightSpecification = 80; return(item); }), GroupHeaderTemplate = new DataTemplate(() => { DefaultTitleItem group = new DefaultTitleItem(); //Set Width Specification as MatchParent to fit the Item width with parent View. group.WidthSpecification = LayoutParamPolicies.MatchParent; group.Label.SetBinding(TextLabel.TextProperty, "Date"); group.Label.HorizontalAlignment = HorizontalAlignment.Begin; return(group); }), Header = myTitle, IsGrouped = true, ScrollingDirection = ScrollableBase.Direction.Vertical, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, SelectionMode = selMode }; colView.SelectionChanged += SelectionEvt; window.Add(colView); }
// Methods public PlaceholderAwareEnumerator(CollectionView collectionView, IEnumerator baseEnumerator, NewItemPlaceholderPosition placeholderPosition, object newItem) { this._collectionView = collectionView; this._timestamp = collectionView.Timestamp; this._baseEnumerator = baseEnumerator; this._placeholderPosition = placeholderPosition; this._newItem = newItem; }
public PropagateCodeGallery(IItemsLayout itemsLayout, int itemsCount = 2) { Title = $"Propagate FlowDirection=RTL"; var layout = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Star } }, FlowDirection = FlowDirection.RightToLeft, Visual = VisualMarker.Material }; var itemTemplate = ExampleTemplates.PropagationTemplate(); var emptyView = ExampleTemplates.PropagationTemplate().CreateContent() as View; var collectionView = new CollectionView { ItemsLayout = itemsLayout, ItemTemplate = itemTemplate, EmptyView = emptyView }; var generator = new ItemsSourceGenerator(collectionView, initialItems: itemsCount); layout.Children.Add(generator); var instructions = new Label(); UpdateInstructions(layout, instructions, itemsCount == 0); Grid.SetRow(instructions, 2); layout.Children.Add(instructions); var switchLabel = new Label { Text = "Toggle FlowDirection" }; var switchLayout = new StackLayout { Orientation = StackOrientation.Horizontal }; var updateSwitch = new Switch { }; updateSwitch.Toggled += (sender, args) => { layout.FlowDirection = layout.FlowDirection == FlowDirection.RightToLeft ? FlowDirection.LeftToRight : FlowDirection.RightToLeft; UpdateInstructions(layout, instructions, itemsCount == 0); }; switchLayout.Children.Add(switchLabel); switchLayout.Children.Add(updateSwitch); Grid.SetRow(switchLayout, 1); layout.Children.Add(switchLayout); layout.Children.Add(collectionView); Grid.SetRow(collectionView, 3); Content = layout; generator.GenerateItems(); }