public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Red }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Green }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Gold }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Silver }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Blue } }; PanPositionChangedCommand = new Command(v => { var val = (bool)v; if (val) { CurrentIndex += 1; return; } CurrentIndex -= 1; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); }
public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Red }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Green }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Gold }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Silver }, new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Blue } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + ((bool)v ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); }
public CarouselSampleXamlViewModel() { Items = new ObservableCollection <object> { new { Source = "tools1.png", Color = Color.Red }, new { Source = "tools2.png", Color = Color.Green }, new { Source = "tools3.png", Color = Color.Gold }, new { Source = "tools4.png", Color = Color.Silver }, new { Source = "tools5.png", Color = Color.Blue }, new { Source = "tools6.png", Color = Color.Red }, new { Source = "tools7.png", Color = Color.Green }, new { Source = "tools8.png", Color = Color.Gold }, new { Source = "tools9.png", Color = Color.Silver }, new { Source = "tools10.png", Color = Color.Blue }, new { Source = "tools11.png", Color = Color.Blue }, new { Source = "tools12.png", Color = Color.Blue }, new { Source = "tools13.png", Color = Color.Blue } //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Red }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Green }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Gold }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Silver }, //new { Source = CreateSource(), Ind = _ImageCount++, Color = Color.Blue } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); GoToLastCommand = new Command(() => { CurrentIndex = Items.Count - 1; }); }
public CubeSampleViewModel() { Items = new ObservableCollection <object> { new { Source = "Tips1.jpg", Color = Color.Red }, new { Source = "Tips2.jpg", Color = Color.Green }, new { Source = "Tips3.jpg", Color = Color.Gold }, new { Source = "Tips4.jpg", Color = Color.Silver }, new { Source = "Tips5.jpg", Color = Color.Blue }, new { Source = "Tips6.jpg", Color = Color.Gold }, new { Source = "Tips7.jpg", Color = Color.Yellow }, new { Source = "Tips8.jpg", Color = Color.Black } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); GoToLastCommand = new Command(() => { CurrentIndex = Items.Count - 1; }); }
public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Description = "Texto de descripción", Date = DateTime.Now.ToShortDateString(), Color = Color.Red }, new { Description = "Texto de descripción en varias líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas líneas", Date = DateTime.Now.ToShortDateString(), Color = Color.Green }, new { Description = "Otro texto de descripción diferente", Date = DateTime.Now.ToShortDateString(), Color = Color.Gold }, new { Description = "Texto de descripción 4324", Date = DateTime.Now.ToShortDateString(), Color = Color.Silver }, new { Description = "Texto de descripción 454554", Date = DateTime.Now.ToShortDateString(), Color = Color.Blue } }; SubItems = new ObservableCollection <string>() { "Texto 1", "Texto 2", "Texto 3", "Texto 4", "Texto 5", "Texto 6", "Texto 7", "Texto 8" }; PanPositionChangedCommand = new Command(v => { var val = (bool)v; if (val) { CurrentIndex += 1; return; } CurrentIndex -= 1; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); }
public CardsSampleViewModel() { Items = new ObservableCollection <object> { new { Source = "happyClass1.png", Color = Color.Red }, new { Source = "happyClass2.png", Color = Color.Green }, new { Source = "happyClass3.png", Color = Color.Gold }, new { Source = "happyClass4.png", Color = Color.Silver }, new { Source = "happyClass5.png", Color = Color.Blue }, new { Source = "happyClass6.png", Color = Color.Red }, new { Source = "happyClass7.png", Color = Color.Green }, new { Source = "happyClass8.png", Color = Color.Gold }, new { Source = "happyClass9.png", Color = Color.Silver }, new { Source = "happyClass10.png", Color = Color.White }, new { Source = "happyClass11.png", Color = Color.AliceBlue }, new { Source = "happyClass12.png", Color = Color.WhiteSmoke }, new { Source = "happyClass13.png", Color = Color.Black }, new { Source = "happyClass14.png", Color = Color.Black }, new { Source = "happyClass15.png", Color = Color.Black }, new { Source = "happyClass16.png", Color = Color.Black }, new { Source = "happyClass17.png", Color = Color.Black }, new { Source = "happyClass18.png", Color = Color.Black }, new { Source = "happyClass19.png", Color = Color.Black }, new { Source = "happyClass20.png", Color = Color.Black }, new { Source = "happyClass21.png", Color = Color.Black }, new { Source = "happyClass22.png", Color = Color.Black }, new { Source = "happyClass23.png", Color = Color.White }, new { Source = "happyClass24.png", Color = Color.LightYellow }, new { Source = "happyClass25.png", Color = Color.OliveDrab }, new { Source = "happyClass26.png", Color = Color.Black }, new { Source = "happyClass27.png", Color = Color.Black }, new { Source = "happyClass28.png", Color = Color.Black }, new { Source = "happyClass29.png", Color = Color.Black }, new { Source = "happyClass30.png", Color = Color.Black }, new { Source = "happyClass31.png", Color = Color.Black } }; PanPositionChangedCommand = new Command(v => { if (IsAutoAnimationRunning || IsUserInteractionRunning) { return; } var index = CurrentIndex + (bool.Parse(v.ToString()) ? 1 : -1); if (index < 0 || index >= Items.Count) { return; } CurrentIndex = index; }); RemoveCurrentItemCommand = new Command(() => { if (!Items.Any()) { return; } Items.RemoveAt(CurrentIndex.ToCyclingIndex(Items.Count)); }); GoToLastCommand = new Command(() => { CurrentIndex = Items.Count - 1; }); }