public MainPage() { this.InitializeComponent(); Condominio c1 = new Condominio("COND 1"); Condominio c2 = new Condominio("COND 2"); Condominio c3 = new Condominio("COND 3"); Condominio c4 = new Condominio("COND 4"); gerente.addCondominio(c1); gerente.addCondominio(c2); gerente.addCondominio(c3); gerente.addCondominio(c4); Bloco b1 = new Bloco(1); Bloco b2 = new Bloco(2); Bloco b3 = new Bloco(3); c1.addBloco(b1); c1.addBloco(b2); c2.addBloco(b3); //CONDOMINIOS listaCondominios = flipCond; listaCondominios.ItemsSource = gerente; //BLOCOS listaBlocos = listBlocos; listaBlocos.ItemsSource = listaCondominios.SelectedItem; }
private void timerrun() { try { DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(2); timer.Tick += (sender, e) => { // bool flag = true; foreach (var i in Screen.Children) { Grid ob1; //if (flag) { flag = false; continue; } try { ob1 = (Grid)i; } catch (InvalidCastException ed) { continue; } FlipView ob2 = (FlipView)ob1.Children.ElementAt(0); int k = ob2.SelectedIndex; if (k < ob2.Items.Count - 1) { k++; } else { k = 0; } ob2.SelectedIndex = k; //flag = true; } }; timer.Start(); } catch (Exception eq) { } }
protected override void Dispose(bool disposing) { if (disposing && !_disposed) { prevBtn = null; nextBtn = null; indicators = null; if (flipView != null) { flipView.SelectionChanged -= FlipView_SelectionChanged; flipView = null; } if (_collectionListenerSource != null) { _collectionListenerSource.CollectionChanged -= ItemsSource_CollectionChanged; _collectionListenerSource = null; } nativeView = null; _disposed = true; } try { base.Dispose(disposing); } catch (Exception ex) { return; } }
private void FlipView_SelectionChanged(object sender, SelectionChangedEventArgs e) { FlipView flip = sender as FlipView; if (flipViewSelectedIndexs[flip] == flip.SelectedIndex) { return; } if (flipviewItemsCount < 3) { return; } if (flip.SelectedIndex == 0) { flip.SelectedIndex = flipviewItemsCount - 2; } else if (flip.SelectedIndex == flipviewItemsCount - 1) { flip.SelectedIndex = 1; } int index = flip.SelectedIndex; flipViewSelectedIndexs[flip] = index; ResetFlipVewAndListBox(new KeyValuePair <FlipView, int>(flip, index)); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { this.navigationHelper.OnNavigatedFrom(e); // Prepare backward transition connected animation if (e.NavigationMode == NavigationMode.Back) { // Pre-fall creator has different image loading order // unable to share same connected animation code without breaking the UI if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5)) { if (FlipView.SelectedIndex >= 0) { try { var container = FlipView.ContainerFromIndex(FlipView.SelectedIndex) as FlipViewItem; var mainPreview = container.ContentTemplateRoot as Grid; var srollViewer = mainPreview.Children.First() as ScrollViewer; var imageGrid = srollViewer.Content as Grid; // Prepare backward connected animation var grid = VisualTreeHelper.GetChild(FlipView, 0) as Grid; var scrollingHost = grid.Children.FirstOrDefault(o => o is ScrollViewer) as UIElement; ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("PreviewImage", imageGrid); } catch (Exception ex) { } } } } }
/*public List<Control> AllChildren(DependencyObject parent) * { * var _list = new List<Control>(); * for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) * { * var _child = VisualTreeHelper.GetChild(parent, i); * if (_child is Control) * _list.Add(_child as Control); * _list.AddRange(AllChildren(_child)); * } * return _list; * }*/ protected override void Dispose(bool disposing) { if (disposing && !_disposed) { indicators = null; if (flipView != null) { flipView.SelectionChanged -= FlipView_SelectionChanged; flipView = null; } if (Element != null) { if (Element.ItemsSource != null && Element.ItemsSource is INotifyCollectionChanged) { ((INotifyCollectionChanged)Element.ItemsSource).CollectionChanged -= ItemsSource_CollectionChanged; } } nativeView = null; _disposed = true; } try { base.Dispose(disposing); } catch (Exception ex) { return; } }
/// <summary> /// Selects a flip view item of the XAML flip view. /// </summary> /// <param name="name">The name of the item to select.</param> /// <returns>The <see cref="FlipViewPage"/>.</returns> public FlipViewPage SelectXamlFlipViewItem(string name) { FlipView xamlFlipView = this.WindowsApp.FindElements(this.flipViewQuery).LastOrDefault(); xamlFlipView.SelectItem(name); return(this); }
public ItaFlipModel(FlipView MainFlip, Category Category) { this.MainFlip = MainFlip; this.Role = ItaListPageViewModel.FlipRole.ItaList; this.Category = Category; ReloadItalist(); }
public WebPageObject(ObservableCollection <WebPageObject> Collection, Uri uri, FlipView flipView) { this.Collection = Collection; this.uri = uri; this.Index = Collection.Count; this.flipView = flipView; }
void SwitchShowBrightCurve(FlipView control) { var photoview = GetCurrentPhotoViewControl(control); if (photoview == null) { return; } if (IsShowCurve) { photoview.Clear(); } else { List <WriteableBitmap> bl = (TestChart as GrayChart).ptp.getGBBrightChangedTestArea(CurrentPhoto, GBSelectAreaNum); List <double> l = (TestChart as GrayChart).ptp.getGBBrightChanged(bl); Canvas c = photoview.getDrawObjectCanvas(); c.Children.Clear(); DrawGraphic dg = new DrawGraphic(c); dg.ForeColor = Colors.Blue; dg.DrawLines(l, 0, 100); } IsShowCurve = !IsShowCurve; }
void SwitchShowSelectArea(FlipView control) { var photoview = GetCurrentPhotoViewControl(control); if (photoview == null) { return; } if (IsShowArea) { photoview.Clear(); } else { for (int i = 0; i < GBSelectAreaNum; i++) { Rectangle r = new Rectangle(); r.Stroke = new SolidColorBrush(Colors.Red); r.StrokeThickness = 3; r.Width = photoview.getDrawObjectCanvas().Width / GBSelectAreaNum; r.Height = photoview.getDrawObjectCanvas().Height / GBSelectAreaNum; Canvas.SetLeft(r, i * r.Width); Canvas.SetTop(r, i * r.Height); photoview.getDrawObjectCanvas().Children.Add(r); } } IsShowArea = !IsShowArea; }
public void SetNativeView() { CleanUpFlipView(); // Orientation BP if (Element.Orientation == CarouselViewOrientation.Horizontal) { nativeView = new FlipViewControl(); } else { nativeView = new VerticalFlipViewControl(); } flipView = nativeView.FindName("flipView") as FlipView; var source = new List <FrameworkElement>(); if (Element.ItemsSource != null && Element.ItemsSource?.GetCount() > 0) { for (int j = 0; j <= Element.ItemsSource.GetCount() - 1; j++) { source.Add(CreateView(Element.ItemsSource.GetItem(j))); } } Source = new ObservableCollection <FrameworkElement>(source); flipView.ItemsSource = Source; //flipView.ItemsSource = Element.ItemsSource; //flipView.ItemTemplateSelector = new MyTemplateSelector(Element); (the way it should be) converter = new ColorConverter(); // BackgroundColor BP flipView.Background = (SolidColorBrush)converter.Convert(Element.BackgroundColor, null, null, null); // IndicatorsTintColor BP fillColor = (SolidColorBrush)converter.Convert(Element.IndicatorsTintColor, null, null, null); // CurrentPageIndicatorTintColor BP selectedColor = (SolidColorBrush)converter.Convert(Element.CurrentPageIndicatorTintColor, null, null, null); flipView.Loaded += FlipView_Loaded; flipView.SelectionChanged += FlipView_SelectionChanged; flipView.SizeChanged += FlipView_SizeChanged; //IsSwipingEnabled BP (not working) //flipView.ManipulationMode = Element.IsSwipingEnabled ? ManipulationModes.All : ManipulationModes.None; if (Source.Count > 0) { flipView.SelectedIndex = Element.Position; } SetNativeControl(nativeView); // INDICATORS indicators = nativeView.FindName("indicators") as StackPanel; SetIndicators(); }
public async Task When_Inline_Items_SelectedIndex() { var flipView = new FlipView { Items = { new FlipViewItem { Content = "Inline item 1" }, new FlipViewItem { Content = "Inline item 2" }, } }; WindowHelper.WindowContent = flipView; await WindowHelper.WaitForLoaded(flipView); Assert.AreEqual(0, flipView.SelectedIndex); flipView.SelectedIndex = 1; await WindowHelper.WaitForIdle(); Assert.AreEqual(1, flipView.SelectedIndex); }
public async Task When_Flipview_Items_Modified() { var itemsSource = new ObservableCollection <string>(); AddItem(itemsSource); AddItem(itemsSource); AddItem(itemsSource); var flipView = new FlipView { ItemsSource = itemsSource }; WindowHelper.WindowContent = flipView; await WindowHelper.WaitForLoaded(flipView); await WindowHelper.WaitForResultEqual(0, () => flipView.SelectedIndex); flipView.SelectedItem = itemsSource[2]; await WindowHelper.WaitForResultEqual(2, () => flipView.SelectedIndex); itemsSource.RemoveAt(2); #if __ANDROID__ await WindowHelper.WaitForResultEqual(0, () => flipView.SelectedIndex); #else await WindowHelper.WaitForResultEqual(-1, () => flipView.SelectedIndex); #endif itemsSource.Clear(); await WindowHelper.WaitForResultEqual(-1, () => flipView.SelectedIndex); }
private void DeviceCarousel_SelectionChanged(object sender, SelectionChangedEventArgs e) { Models.Thermostat target = DeviceCarousel.SelectedItem as Models.Thermostat; if (null == target) { return; } for (int i = 0; i < ViewModel.DeviceList.Count; ++i) { ViewModel.DeviceList[i].DeviceBrush = (target == ViewModel.DeviceList[i]) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Color.FromArgb(0xff, 0x87, 0x87, 0x87)); ViewModel.DeviceList[i].DeviceBallBrush = (target == ViewModel.DeviceList[i]) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Colors.Transparent); ViewModel.DeviceList[i].DevicePrevBallBrush = (target == ViewModel.DeviceList[i] && 0 < i && 1 < ViewModel.DeviceList.Count) ? new SolidColorBrush(Color.FromArgb(0xff, 0x87, 0x87, 0x87)) : new SolidColorBrush(Colors.Transparent); ViewModel.DeviceList[i].DeviceNextBallBrush = (target == ViewModel.DeviceList[i] && (i + 1) < ViewModel.DeviceList.Count) ? new SolidColorBrush(Color.FromArgb(0xff, 0x87, 0x87, 0x87)) : new SolidColorBrush(Colors.Transparent); } FlipView.Visibility = (target.is_online) ? Visibility.Visible : Visibility.Collapsed; offline.Visibility = (false == target.is_online) ? Visibility.Visible : Visibility.Collapsed; hDown.Visibility = (target.is_online) ? Visibility.Visible : Visibility.Collapsed; hUp.Visibility = (target.is_online) ? Visibility.Visible : Visibility.Collapsed; //tSlider.Visibility = (target.is_online) ? Visibility.Visible : Visibility.Collapsed; FlipView.Focus(FocusState.Pointer); }
public async Task When_Observable_ItemsSource_And_Added() { var itemsSource = new ObservableCollection <string>(); AddItem(itemsSource); AddItem(itemsSource); AddItem(itemsSource); var flipView = new FlipView { ItemsSource = itemsSource }; WindowHelper.WindowContent = flipView; await WindowHelper.WaitForLoaded(flipView); Assert.AreEqual(0, flipView.SelectedIndex); flipView.SelectedIndex = 1; await WindowHelper.WaitForIdle(); Assert.AreEqual(1, flipView.SelectedIndex); AddItem(itemsSource); await WindowHelper.WaitForIdle(); Assert.AreEqual(1, flipView.SelectedIndex); }
/*public List<Control> AllChildren(DependencyObject parent) * { * var _list = new List<Control>(); * for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) * { * var _child = VisualTreeHelper.GetChild(parent, i); * if (_child is Control) * _list.Add(_child as Control); * _list.AddRange(AllChildren(_child)); * } * return _list; * }*/ /*class MyTemplateSelector : DataTemplateSelector * { * CarouselViewControl Element; * double ElementWidth; * double ElementHeight; * * public MyTemplateSelector(CarouselViewControl element, double width, double height) * { * this.Element = element; * this.ElementWidth = width; * this.ElementHeight = height; * } * * protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) * { * Xamarin.Forms.View formsView = null; * var bindingContext = item; * * var selector = this.Element.ItemTemplate as Xamarin.Forms.DataTemplateSelector; * if (selector != null) * formsView = (Xamarin.Forms.View)selector.SelectTemplate(bindingContext, this.Element).CreateContent(); * else * formsView = (Xamarin.Forms.View)this.Element.ItemTemplate.CreateContent(); * * formsView.BindingContext = bindingContext; * * var uielement = FormsViewToNativeUWP.ConvertFormsToNative(formsView, new Xamarin.Forms.Rectangle(0, 0, this.ElementWidth, this.ElementHeight)); * * var flipViewItem = (FlipViewItem)container; * * flipViewItem.Content = uielement; * * return base.SelectTemplateCore(item, container); * } * }*/ protected override void Dispose(bool disposing) { if (disposing && !_disposed) { if (flipView != null) { flipView.SelectionChanged -= FlipView_SelectionChanged; flipView = null; } indicators = null; nativeView = null; _disposed = true; } try { base.Dispose(disposing); } catch (Exception ex) { return; } }
public UIElement addTitle(string text, FlipView flipView) { TextBlock temp = new TextBlock(); temp.Width = SizeElement.Width - 10; temp.Text = text; temp.FontSize = fontSize; temp.Foreground = FontColor; temp.TextWrapping = TextWrapping.Wrap; temp.FontWeight = FontWeights.Bold; if (flipView.Items[0] is ScrollViewer) { Button tempNav = new Button(); tempNav.Foreground = FontColor; tempNav.Content = text; tempNav.Width = SizeElement.Width - 20; int t = flipView.Items.Count; tempNav.Click += (sender, e) => { flipView.SelectedIndex = t; }; ScrollViewer sv = (ScrollViewer)flipView.Items[0]; StackPanel stackp = (StackPanel)sv.Content; stackp.Children.Add(tempNav); } return(addStack(temp)); }
public void SetUp() { this.flipView = new FlipView(); this.flipView.Items.Add(new DummyItem(0)); this.flipView.Items.Add(new DummyItem(1)); this.flipView.Items.Add(new DummyItem(2)); }
public PicsFlipView() { this.InitializeComponent(); timer.Interval = TimeSpan.FromSeconds(5); timer.Tick += Timer_Tick; picflipview = flipview; }
private async void FlipView_SelectionChanged(object sender, SelectionChangedEventArgs e) { Debug.WriteLine($"Index={ImagesViewModel.SelectedIndex}, {(sender as FlipView).SelectedIndex}"); FlipView.UpdateLayout(); if (FlipView.SelectedIndex == indexFromLastPage && readyForConnectedAnimation) { HandleConnectedAnimation(); } // Increamental load when needed (e.g. last 3) if (ImagesViewModel.SelectedIndex >= ImagesViewModel.Images.Count - 10) { uint newItemCount = 0; while (ImagesViewModel.Posts != null && ImagesViewModel.Posts.HasMoreItems && newItemCount == 0) { var result = await ImagesViewModel.Posts.LoadMoreItemsAsync(10); newItemCount = result.Count; } } if (ImagesViewModel.SelectedImageViewModel != null) { var tasks = new List <Task>(); tasks.Add(ImagesViewModel.SelectedImageViewModel.UpdateIsFavorited()); tasks.Add(ImagesViewModel.SelectedImageViewModel.UpdateComments()); //await Task.WhenAll(tasks); } }
private void CreateSlider() { flipViewWrap = new FlipView(); WebView[][] webViews = new WebView[urls.Length][]; FlipView[] flipViews = new FlipView[urls.Length]; for (int i = 0; i < urls.Length; i++) { flipViews[i] = new FlipView(); webViews[i] = new WebView[urls[i].Length]; for (int j = 0; j < urls[i].Length; j++) { webViews[i][j] = new WebView(); try { if (String.IsNullOrEmpty(urls[i][j])) { throw new Exception(); } if (urls[i][j].Equals("about:blank")) { throw new Exception(); } if (!urls[i][j].StartsWith("http://") && !urls[i][j].StartsWith("https://")) { urls[i][j] = "http://" + urls[i][j]; } Uri targetUri; if (Uri.TryCreate(urls[i][j], UriKind.Absolute, out targetUri)) // && (targetUri.Scheme == Uri.UriSchemeHttp)) { webViews[i][j].Navigate(targetUri); } else { throw new Exception(); } } catch (Exception ex) { webViews[i][j].NavigateToString("<html><body><h2>Can't download " + urls[i][j] + "</h2></body></html>"); System.Diagnostics.Debug.Write(ex.ToString()); } } var itemsPanelTemplate = new ItemsPanelTemplate(); itemsPanelTemplate.SetValue(VirtualizingStackPanel.OrientationProperty, Orientation.Vertical); flipViews[i].ItemsPanel = itemsPanelTemplate; flipViews[i].ItemsSource = webViews[i]; } flipViewWrap.ItemsSource = flipViews; sliderWrap.Children.Add(flipViewWrap); }
private void FlipView_Loaded(object sender, RoutedEventArgs e) { FlipView.UpdateLayout(); if (FlipView.SelectedIndex == indexFromLastPage) { HandleConnectedAnimation(); } }
protected void NavUserControl_Loaded(object sender, RoutedEventArgs e) { NavFlipView = (FlipView)this.FindName("NavFlipView"); PagingIndicatorListBox = (ListBox)this.FindName("PagingIndicatorListBox"); GetPageInfo(); LayoutNavControl(new Size(Window.Current.Bounds.Width, Window.Current.Bounds.Height)); }
public ItaListPageViewModel(FlipView MainFlip) { FlipList = new ObservableCollection <IFlipModel>(); this.MainFlip = MainFlip; MainFlip.SelectionChanged += MainFlip_SelectionChanged; MainFlip.DataContextChanged += MainFlip_DataContextChanged; MainFlip.SizeChanged += MainFlip_SizeChanged; }
private void ButtonHide(FlipView f, string name) { Button b; b = FindVisualChild <Button>(f, name); b.Opacity = 0.0; b.IsHitTestVisible = false; }
public ThreadFlipModel(FlipView MainFlip, Ita Ita) { this.MainFlip = MainFlip; this.Ita = Ita; this.Role = ItaListPageViewModel.FlipRole.ThreadList; ThreadList = new ObservableCollection <Thread>(); ReloadThreadList(); }
private void FlipView_SelectionChanged(object sender, SelectionChangedEventArgs e) { FlipView flipView1 = new FlipView(); flipView1.Items.Add("Item 1"); flipView1.Items.Add("Item 2"); flipView1.SelectionChanged += FlipView_SelectionChanged; }
private void Guide_FlipView_Loaded(object sender, RoutedEventArgs e) { this.flipView = (FlipView)sender; timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(10); timer.Tick += Timer_Tick; timer.Start(); }
public void Remove(FlipView display) { if (display.SelectedItem != null) { Collection.Remove(Collection.Where(w => w.Id == ((Music)display.SelectedValue).Id).Single()); Write(); } }