private void VerticalTabView_TabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) { switch (args.CollectionChange) { case Windows.Foundation.Collections.CollectionChange.ItemRemoved: App.InteractionViewModel.TabStripSelectedIndex = Items.IndexOf(VerticalTabView.SelectedItem as TabItem); break; case Windows.Foundation.Collections.CollectionChange.ItemInserted: App.InteractionViewModel.TabStripSelectedIndex = (int)args.Index; break; } if (App.InteractionViewModel.TabStripSelectedIndex >= 0 && App.InteractionViewModel.TabStripSelectedIndex < Items.Count) { CurrentSelectedAppInstance = GetCurrentSelectedTabInstance(); if (CurrentSelectedAppInstance != null) { OnCurrentInstanceChanged(new CurrentInstanceChangedEventArgs() { CurrentInstance = CurrentSelectedAppInstance, PageInstances = GetAllTabInstances() }); } } }
private async void OnTabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs e) { if (TabItems.Count == 0 && !isCreatingNewAppWindow) { await TryCloseAsync(); } }
private void HorizontalTabView_TabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) { switch (args.CollectionChange) { case Windows.Foundation.Collections.CollectionChange.ItemRemoved: App.InteractionViewModel.TabStripSelectedIndex = Items.IndexOf(HorizontalTabView.SelectedItem as TabItem); break; case Windows.Foundation.Collections.CollectionChange.ItemInserted: App.InteractionViewModel.TabStripSelectedIndex = (int)args.Index; break; } }
private async void Tabs_TabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) { // If there are no more tabs, close the window. if (sender.TabItems.Count == 0) { if (RootAppWindow != null) { await RootAppWindow.CloseAsync(); } else { Window.Current.Close(); } } }
private void HorizontalTabView_TabItemsChanged(TabView sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) { if (args.CollectionChange == Windows.Foundation.Collections.CollectionChange.ItemRemoved) { App.InteractionViewModel.TabStripSelectedIndex = Items.IndexOf(HorizontalTabView.SelectedItem as TabItem); } if (App.InteractionViewModel.TabStripSelectedIndex >= 0 && App.InteractionViewModel.TabStripSelectedIndex < Items.Count) { CurrentSelectedAppInstance = GetCurrentSelectedTabInstance(); if (CurrentSelectedAppInstance != null) { OnCurrentInstanceChanged(new CurrentInstanceChangedEventArgs() { CurrentInstance = CurrentSelectedAppInstance, PageInstances = GetAllTabInstances() }); } } }
private void Items_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { //Debug.WriteLine("Collection changed."); }
private void ConversationListScrollBottom(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { if (ConversationListBox.Items.Count > 0) { ConversationListBox.ScrollIntoView(ConversationListBox.Items[ConversationListBox.Items.Count - 1]); } }
private void Items_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { if (_IsEmptyItem) { if (this.AssociatedObject.Items.Count > 0) { var first = this.AssociatedObject.Items.First(); var a = this.AssociatedObject.ContainerFromItem(first) as FrameworkElement; if (a != null) { if (IsEnabled) { var control = a.FindFirstChild <Control>(); control?.Focus(FocusState.Programmatic); } _IsEmptyItem = false; } } } else { _IsEmptyItem = this.AssociatedObject.Items.Count == 0; } }
void Subreddits_CollectionChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { Dispatcher.Invoke(CoreDispatcherPriority.Normal, (x, y) => { }, this, null); //this.ItemGridView.UpdateLayout(); }
private void Items_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { UpdateNonFoundVisibility(); }
private async void Items_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { // If there are no more tabs and we're in a secondary AppWindow, close that Window. if (sender.Count == 0 && RootAppWindow != null) { await RootAppWindow.CloseAsync(); } // TODO: Close the root CoreApplicationView? }
private void OnMyListViewItems_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { //Task updSelIdx = RunInUiThreadAsync(MyListView?.Dispatcher, delegate Task updSelIdx = RunInUiThreadAsync(delegate { if (MyListView.Items?.Count > SelectedIndex) { MyListView.SelectedIndex = SelectedIndex; //MyListView.SelectRange(new Windows.UI.Xaml.Data.ItemIndexRange(SelectedIndex, 1)); // you can only call this if multiple selections are allowed } }); }
void Items_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { UpdateGroupedSeries(); UpdateGroupedPieSeries(); }
private void VectorChanged(Windows.Foundation.Collections.IObservableVector <ICommandBarElement> sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) { if (args.CollectionChange == Windows.Foundation.Collections.CollectionChange.Reset) { #if WINDOWS_APP secondaryFlyout = null; #endif needseparator = false; if (!reflowing) { primary.Clear(); secondary.Clear(); } } else if (args.CollectionChange == Windows.Foundation.Collections.CollectionChange.ItemInserted) { var itembase = sender[(int)args.Index]; itembase.IsCompact = true; #if WINDOWS_APP if (sender == SecondaryCommands) { if (secondaryFlyout == null) { var ellipsis = new AppBarEllipsis { Flyout = secondaryFlyout = new MenuFlyout() }; PrimaryCommands.Add(ellipsis); secondaryFlyout.Opening += SecondaryFlyout_Opening; secondaryFlyout.Closed += SecondaryFlyout_Closed; } if (needseparator) { needseparator = false; secondaryFlyout.Items.Add(new MenuFlyoutSeparator()); } if (itembase is AppBarSeparator sep) { secondaryFlyout.Items.Add(new MenuFlyoutSeparator()); } else if (itembase is AppBarButton button) { if (!reflowing && !primary.Contains(button)) { secondary.Add(button); } var menuitem = new MenuFlyoutItemEx { Text = button.Label, Command = button.Command, DataContext = button.DataContext, }; if (button.Icon is BitmapIcon bmp) { menuitem.Icon = new BitmapIcon { UriSource = bmp.UriSource } } ; else if (button.Icon is SymbolIcon sym) { menuitem.Icon = new SymbolIcon(sym.Symbol); } if (menuitem.DataContext is Ao3TrackReader.Controls.ToolbarItem) { // Create the binding description. Binding b = new Binding() { Mode = BindingMode.OneWay, Path = new PropertyPath("Foreground"), Converter = new ColorConverter() }; menuitem.SetBinding(MenuFlyoutItemEx.ForegroundProperty, b); } secondaryFlyout.Items.Add(menuitem); } if (itembase is FrameworkElement elem) { elem.Visibility = Visibility.Collapsed; } return; } #endif if (itembase is FrameworkElement e) { e.Visibility = Visibility.Visible; } var item = itembase as AppBarButton; if (item == null) { return; } if (AppBarButtonTemplate != null) { item.Template = AppBarButtonTemplate; } var xitem = item.DataContext as Xamarin.Forms.ToolbarItem; if (xitem == null) { return; } if (sender == PrimaryCommands) { if (!reflowing) { primary.Add(item); if (!haveDynamicOverflow && ActualWidth > 0) { uint limit = (uint)Math.Floor(ActualWidth / 68) - 1; if (args.Index >= limit) { item.Visibility = Visibility.Collapsed; needseparator = false; var newitem = new AppBarButton { Label = item.Label, Command = item.Command, DataContext = item.DataContext }; if (item.Icon is BitmapIcon bmp) { newitem.Icon = new BitmapIcon { UriSource = bmp.UriSource } } ; else if (item.Icon is SymbolIcon sym) { newitem.Icon = new SymbolIcon(sym.Symbol); } SecondaryCommands.Add(newitem); needseparator = true; return; } } } } else if (sender == SecondaryCommands) { if (needseparator) { needseparator = false; #if !WINDOWS_PHONE_APP SecondaryCommands.Insert((int)args.Index, new AppBarSeparator()); #else SecondaryCommands.Insert((int)args.Index, new AppBarButton { Label = "\x23AF\x23AF\x23AF\x23AF", IsEnabled = false, }); #endif } if (!reflowing) { secondary.Add(item); } var ti = GetTemplateChild("SecondaryItemsControl"); } item.ClearValue(AppBarButton.IconProperty); if (!string.IsNullOrWhiteSpace(xitem.Icon?.File)) { #if !WINDOWS_PHONE_APP var uri = new Uri("ms-appx:///" + xitem.Icon.File); #else var uri = new Uri("ms-appx:///Appbar/" + xitem.Icon.File); #endif item.Icon = new BitmapIcon() { UriSource = uri }; } if (item.DataContext is Ao3TrackReader.Controls.ToolbarItem) { // Create the binding description. Binding b = new Binding() { Mode = BindingMode.OneWay, Path = new PropertyPath("Foreground"), Converter = new ColorConverter() }; item.SetBinding(AppBarButton.ForegroundProperty, b); } } }
private void ListViewItems_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { if (_listView != null && !double.IsNaN(_listView.ActualWidth)) { // If the item count changes, check if more or less columns needs to be rendered, // in case we were having fewer items than columns. RecalculateLayout(_listView.ActualWidth); } }
private void OnMyListViewItems_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { Task updSelIdx = RunInUiThreadAsync(delegate { UpdateDescriptor(); UpdateSelection(); }); }
void View_VectorChanged(Windows.Foundation.Collections.IObservableVector <object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { UpdateCompanyStatus(); }
private void OutputPortDescriptors_VectorChanged(Windows.Foundation.Collections.IObservableVector <MidiDeviceInformation> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { //System.Diagnostics.Debug.WriteLine("OutputPortDescriptors - VectorChanged"); System.Diagnostics.Debug.WriteLine(@event.CollectionChange); }
private void Commands_VectorChanged(Windows.Foundation.Collections.IObservableVector <ICommandBarElement> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event) { Update(); }
private void CompositeStateTrigger_VectorChanged(Windows.Foundation.Collections.IObservableVector <DependencyObject> sender, Windows.Foundation.Collections.IVectorChangedEventArgs e) { if (e.CollectionChange == Windows.Foundation.Collections.CollectionChange.ItemInserted) { var item = sender[(int)e.Index] as StateTriggerBase; if (item != null) { OnTriggerCollectionChanged(null, new StateTriggerBase[] { item }); } } //else: Handle remove and reset }
private void PlaybackItem_TimedMetadataTracksChanged(MediaPlaybackItem sender, Windows.Foundation.Collections.IVectorChangedEventArgs args) { if (args.CollectionChange == Windows.Foundation.Collections.CollectionChange.ItemInserted) { sender.TimedMetadataTracksChanged -= PlaybackItem_TimedMetadataTracksChanged; // unselect other subs for (uint i = 0; i < sender.TimedMetadataTracks.Count; i++) { sender.TimedMetadataTracks.SetPresentationMode(i, TimedMetadataTrackPresentationMode.Disabled); } // pre-select added subtitle sender.TimedMetadataTracks.SetPresentationMode(args.Index, TimedMetadataTrackPresentationMode.PlatformPresented); } }