public MainTab(int page, TabItem newTab, Image newVerso, Image newRecto, Grid canvas, Grid vGrid, Grid rGrid, Button delBtn, ScatterView SV, ScatterViewItem si, Grid vSwipeGrid, Grid rSwipeGrid, Grid vTranslationGrid, Grid rTranslationGrid, Grid vBoxesGrid, Grid rBoxesGrid, TextBlock headerText, SurfaceWindow1.language language) { _page = page; _tab = newTab; _verso = newVerso; _recto = newRecto; _canvas = canvas; _vGrid = vGrid; _rGrid = rGrid; _SVI = si; _delButton = delBtn; numFingersRecto = 0; numFingersVerso = 0; fingerPos = new List<Point>(); avgTouchPoint = new Point(-1, 0); _vSwipeGrid = vSwipeGrid; _rSwipeGrid = rSwipeGrid; _vTranslationGrid = vTranslationGrid; _rTranslationGrid = rTranslationGrid; _vBoxesGrid = vBoxesGrid; _rBoxesGrid = rBoxesGrid; _twoPage = true; _SV = SV; _headerTB = headerText; _currentLanguage = language; _previousLanguage = _currentLanguage; _worker = new Workers(this); }
//Set position of ScatterViewItems in a ScatterView as organized rows public static Point SetPosition(ScatterViewItem svi) { Point newCenter; try { ScatterView parentSV = (ScatterView)svi.Parent; double ParentWidth = parentSV.Width; double ParentHeight = parentSV.Height; int NumberParts = (int)Math.Floor((ParentWidth / (svi.Width + 10))); int count = parentSV.Items.Count; double startX = svi.Width / 2 + 10; double startY = (svi.Height + 10) / 2; int multiplierX = (count - 1) % NumberParts; int multiplierY = (count - 1) / NumberParts; newCenter = new Point(startX + multiplierX * (svi.Width + 10), startY + multiplierY * (svi.Height + 10)); //If newCenter is too low to fit entire svi into the bottom row, increase parentSV height if (newCenter.Y > ParentHeight - (svi.Width / 2)) { parentSV.Height = parentSV.Height + (svi.Height + 10); } } catch (Exception exc) { Console.WriteLine(exc); newCenter = new Point(0, 0); } return(newCenter); }
public void activateFilterTile(String str, Brush color, object tag) { Label label = new Label(); label.Foreground = Brushes.White; label.Content = str; ScatterViewItem filterTile = new ScatterViewItem(); filterTile.PreviewMouseDown += new MouseButtonEventHandler(filterTile_PreviewMouseDown); filterTile.MouseUp += new System.Windows.Input.MouseButtonEventHandler(filterTile_MouseUp); filterTile.TouchEnter += new EventHandler<TouchEventArgs>(filterTile_TouchEnter); filterTile.TouchLeave += new EventHandler<TouchEventArgs>(filterTile_TouchLeave); filterTile.MinHeight = 0; filterTile.Height = 35; filterTile.Orientation = 0; filterTile.CanMove = false; filterTile.CanRotate = false; filterTile.CanScale = false; filterTile.ShowsActivationEffects = false; filterTile.Background = color; filterTile.Tag = tag; filterTile.Content = label; ((Canvas)(this.Content)).Children.Add(filterTile); this.addFilter(tag, filterTile); }
private void WidgetHosts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (IWidgetHost host in e.NewItems) { WidgetDescriptor descriptor = GetDescriptor(host.Widget); ScatterViewItem viewItem = (ScatterViewItem)host; Point position = descriptor.Position; Binding binding = new Binding("Position"); binding.Source = descriptor; binding.Mode = BindingMode.OneWayToSource; viewItem.SetBinding(ScatterViewItem.CenterProperty, binding); _scatterView.Items.Add(host); viewItem.Center = position; } } if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (var newItem in e.OldItems) { _scatterView.Items.Remove(newItem); } } }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { if (!DesignerProperties.GetIsInDesignMode(this)) { _TriggerButton = GetTemplateChild("PART_TriggerButton") as SurfaceButton; _TriggerButton.Click += TriggerButton_Click; _ListBox = GetTemplateChild("PART_ListBox") as SurfaceListBox; _ListBox.LayoutUpdated += ListBox_LayoutUpdated; _ListBox.SelectedIndex = SelectedIndex; _ListBox.SelectionChanged += ListBox_SelectionChanged; _ListBox.PreviewMouseDown += (sender, e) => HandleClickOrTap(e.OriginalSource); Loaded += (sender, e) => { ScatterViewItem svi = this.FindVisualParent <ScatterViewItem>(); if (svi != null) { // If hosted within a ScatterViewItem, close whenever the SVI is manipulated. svi.PreviewMouseLeftButtonDown += (a, b) => CloseOnParentInteraction(b.OriginalSource as FrameworkElement); svi.PreviewTouchDown += (a, b) => CloseOnParentInteraction(b.OriginalSource as FrameworkElement); } }; } base.OnApplyTemplate(); }
private void select_Sequence(object sender, RoutedEventArgs e) { String s = ""; foreach (UIElement l1 in this.Children) { if (l1.GetType() == typeof(L1Module)) { foreach (UIElement p in ((L1Module)l1).L1Grid.Children) { if (p.GetType() == typeof(Part)) { s = s + ((Part)p).myRegDS.BasicInfo.Sequence + "\n"; } } } } TextBlock sequence = new TextBlock(); sequence.Text = s; ScatterViewItem svi = new ScatterViewItem(); svi.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(seq_ContainerManipulationCompleted); svi.Content = sequence; SurfaceWindow1.addData(sender, svi); }
//Method for generating the Sequence scatterview item from the element menu private void select_Sequence(object sender, RoutedEventArgs e) { _thisRegDS = new RegDataSheet("http://partsregistry.org/wiki/index.php?title=Part:" + this.partName.Text); seq = new ScatterViewItem(); seq.CanRotate = false; seq.CanScale = false; TextBlock seqtext = new TextBlock(); //Creates a textblock to be inserted into the scatterview seqtext.Margin = new Thickness(10); seq.Background = Brushes.SteelBlue; seqtext.Background = Brushes.White; seq.Width = 800; seq.MinHeight = 600; seqtext.Width = 790; seqtext.MinHeight = 590; seqtext.Text = "Parts Registry ID: " + _thisRegDS.Name + "\n" + "\n" + "Sequence:" + "\n" + "\n" + _thisRegDS.BasicInfo.Sequence; seq.Content = seqtext; SurfaceWindow1.addData(sender, seq); seq.ContainerManipulationCompleted += new ContainerManipulationCompletedEventHandler(onSeqManipulationCompleted); //Event handler that allows trashing when swiped to the right seq.Orientation = 0; //Overwrites center calculated in addData(); consider checking out later Point PartCenter = this.Center; Point OriginalCenter = seq.Center; OriginalCenter.X = (PartCenter.X); OriginalCenter.Y = (PartCenter.Y + 370); seq.Center = OriginalCenter; }
//====================================================================== // Canvas Functions //====================================================================== // For mouse clicks private void Click(object sender, MouseButtonEventArgs e) { if ((canPlaceHouse) && (!tagDetected)) { RoadCanvas.IsEnabled = false; redoList = new List <Object>(); e.Handled = true; UrbanTagVisualizer.UpdateLayout(); Point mousePosition = e.GetPosition(this); // Setting the ScatterView image background ScatterViewItem item = SetSVHouseImage(houseType); item.Center = mousePosition; item.Orientation = 0; MainScatterview.Items.Add(item); userPlacedHouses.Add(item); history.Push(item); } else if ((canPlaceRoad) && (!tagDetected)) { RoadCanvas.IsEnabled = true; } }
private void AddSingleIdeaGroup(IdeationUnit ideaGroup) { try { IdeaGroupUI groupUI = new IdeaGroupUI(); groupUI.setNoteID(ideaGroup.Id); groupUI.Tag = ideaGroup; groupUI.update(ideaGroup); ScatterViewItem container = new ScatterViewItem(); container.Content = groupUI; container.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); container.Width = groupUI.Width; container.Height = groupUI.Height; container.Orientation = 0; container.CanScale = false; container.CanRotate = false; container.Center = new System.Windows.Point(ideaGroup.CenterX, ideaGroup.CenterY); groupUI.InitContainer(container); sv_MainCanvas.Items.Add(container); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } }
// Sets the image of the house ScatterView based on which type of house is selected private ScatterViewItem SetSVHouseImage(String type) { ScatterViewItem item = new ScatterViewItem(); BitmapImage img = new BitmapImage(); double resize_value = 0.2; if (type.Equals("HouseEMI", StringComparison.Ordinal)) { img = new BitmapImage(new Uri("Resources/iso_house_1.png", UriKind.Relative)); } else if (type.Equals("BuildingEMI", StringComparison.Ordinal)) { img = new BitmapImage(new Uri("Resources/iso_building_1.png", UriKind.Relative)); } else if (type.Equals("SkyscraperEMI", StringComparison.Ordinal)) { img = new BitmapImage(new Uri("Resources/iso_skyscraper_1.png", UriKind.Relative)); resize_value = 0.165; } ImageBrush imgBrush = new ImageBrush(); imgBrush.ImageSource = img; item.Background = imgBrush; item.Height = img.Height * resize_value; item.Width = img.Width * resize_value; item.CanRotate = false; item.CanScale = false; return(item); }
public static void ThrowSVI(ScatterViewItem svi, Point targetPoint, double targetOrientation, double fromTime, double toTime) { SurfaceAnimateUtility.AnimateElementPoint(svi, ScatterViewItem.CenterProperty, targetPoint, fromTime, toTime); SurfaceAnimateUtility.AnimateElementDouble(svi, ScatterViewItem.OrientationProperty, targetOrientation, fromTime, toTime); }
public override void addFilter(object query, ScatterViewItem filterTile) { double y = (40 * (this.filters.Count)) - 10; Canvas.SetRight(filterTile, this.ActualWidth - 10); Canvas.SetTop(filterTile, y); this.filters.Add((iFilter)query); }
//---------------------------------------------------------// /// <summary> /// Animates all current pieces off the side of the screen. /// </summary> private void RemoveAllPieces() { if (scatter.Items.Count == 0) { selectionEnabled = true; return; } // Use a for loop here instead of a foreach so the variable used in the animation complete // callback is not modified between the time the callback is hooked up and the time it is called. for (int i = 0; i < scatter.Items.Count; i++) { ScatterViewItem item = (ScatterViewItem)scatter.Items[i]; PointAnimation remove = ((PointAnimation)Resources["RemovePiece"]).Clone(); // Can't animate if center isn't set yet, which would happen if a piece has not yet been manipulated if (double.IsNaN(item.Center.X)) { item.Center = item.ActualCenter; } // Set up a callback that passes the ScatterViewItem that will be needed when the animation completes remove.Completed += delegate(object sender, EventArgs e) { OnRemoveAnimationCompleted(item); }; // Start the animation item.BeginAnimation(ScatterViewItem.CenterProperty, remove, HandoffBehavior.SnapshotAndReplace); } }
private void ItemInit(object sender, RoutedEventArgs e) { //Initalisierung eines News Items (Animationen, Position) ScatterViewItem item = sender as ScatterViewItem; TranslateTransform offsetTransform = new TranslateTransform(); item.RenderTransform = offsetTransform; Random rnd = new Random(); item.CanScale = false; item.SingleInputRotationMode = SingleInputRotationMode.ProportionalToDistanceFromCenter; item.Orientation = rnd.Next(30) - 15; Point startPoint = new Point(1820 - item.ActualWidth / 2, 400); Point endPoint = new Point(840 - item.ActualWidth / 2, 450); item.Center = endPoint; FillBehavior fillBehavior = FillBehavior.Stop; PointAnimation offsetYAnimation = new PointAnimation(startPoint, endPoint, new Duration(TimeSpan.FromSeconds(.5)), fillBehavior); offsetYAnimation.BeginTime = TimeSpan.FromSeconds(0); item.BeginAnimation(ScatterViewItem.CenterProperty, offsetYAnimation); DoubleAnimation scaleAnimation = new DoubleAnimation(60, 500, new Duration(TimeSpan.FromSeconds(.5)), fillBehavior); scaleAnimation.BeginTime = TimeSpan.FromSeconds(0); item.BeginAnimation(ScatterViewItem.HeightProperty, scaleAnimation); }
/// <summary> /// Speichert Eltern-ScatterViewItem und Klappt einige Abschnitte ein. /// </summary> /// <param name="svi">Eltern.ScatterViewItem</param> public void SetParentSVIAndReduceAreas(ScatterViewItem svi) { _parentSVI = svi; SetInfoGridHeights(); ReduceHistoryArea(); ReduceModelArea(); }
// For mouse clicks private void Click(object sender, MouseButtonEventArgs e) { if ((canPlaceHouse) && (!tagDetected)) { RoadCanvas.IsEnabled = false; redoList = new List <Object>(); e.Handled = true; MainPanel.UpdateLayout(); Point mousePosition = e.GetPosition(this); mousePosition.X += MainPanel.HorizontalOffset; mousePosition.Y += MainPanel.VerticalOffset; // Setting the ScatterView image background ScatterViewItem item = new ScatterViewItem(); item = SetSVHouseImage(item, houseType); item.Center = mousePosition; item.Orientation = 0; MainScatterview.Items.Add(item); history.Push(item); } else if ((canPlaceRoad) && (!tagDetected)) { RoadCanvas.IsEnabled = true; } }
//Set the house type based on two variables private ScatterViewItem setBuildingType(int varOne, int varTwo) { ScatterViewItem building = SetSVHouseImage("HouseEMI");; switch (varOne % 2) { case 0: switch (varTwo % 2) { case 0: building = SetSVHouseImage("HouseEMI"); break; case 1: building = SetSVHouseImage("BuildingEMI"); break; } break; case 1: switch (varTwo % 2) { case 0: building = SetSVHouseImage("BuildingEMI"); break; case 1: building = SetSVHouseImage("HouseEMI"); break; } break; } return(building); }
private void AddSinglePostItNote(IdeationUnit idea, int initAngle, bool init) { try { IPostItUI addedIdeaUI = null; ScatterViewItem container = new ScatterViewItem(); PostItNote castNote = (PostItNote)idea; if (castNote.Content is Bitmap) { ImageBasedPostItUI noteUI = new ImageBasedPostItUI(); noteUI.Tag = idea; noteUI.setNoteID(castNote.Id); noteUI.update(idea); noteUI.Width = noteUI.InitWidth; noteUI.Height = noteUI.InitHeight; if (castNote.MetaData.UiBackgroundColor.Length > 0) { noteUI.setBackgroundPostItColor(castNote.MetaData.UiBackgroundColor); noteUI.approvedNewBackgroundColor(castNote.MetaData.UiBackgroundColor); } container.Content = noteUI; container.Width = noteUI.Width; container.Height = noteUI.Height; if (idea.CenterX == 0 && idea.CenterY == 0) { int centerX = (int)(container.Width / 2); int centerY = (int)(sv_MainCanvas.Height - container.Height / 2); idea.CenterX = centerX; idea.CenterY = centerY; } sv_MainCanvas.Items.Add(container); container.Center = new System.Windows.Point(idea.CenterX, idea.CenterY); container.Orientation = initAngle; container.ZIndex = 1; container.CanScale = false; addedIdeaUI = noteUI; addedIdeaUI.InitContainer(container); } if (addedIdeaUI != null) { if (init) { addedIdeaUI.startJustAddedAnimation(container.Orientation); } addedIdeaUI.noteUITranslatedEventHandler += new NoteUITranslatedEvent(noteUIManipluatedEventHandler); addedIdeaUI.noteUIDeletedEventHandler += new NoteUIDeletedEvent(noteUIDeletedEventHandler); addedIdeaUI.noteUISizeChangedListener += new NoteUISizeChangedEvent(addedIdeaUI_noteUISizeChangedListener); addedIdeaUI.colorPaletteLaunchedEventHandler += new ColorPaletteLaunchedEvent(addedIdeaUI_colorPaletteLaunchedEventHandler); } Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_NoteAdded(idea)); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } }
public FileFetcher(String deviceId, ScatterViewItem item, String originalFileFullPath, SlidboardView view) { this.DEVICE_ID = deviceId; this.item = item; this.originalFileFullPath = originalFileFullPath; this.view = view; }
public override void addFilter(object attTag, ScatterViewItem filterTile) { double y = (40 * (this.attributes.Count)) - 10; Canvas.SetRight(filterTile, 105); Canvas.SetTop(filterTile, y); attributes.Add((String)attTag); }
public Bubble(int _id, ScatterViewItem scatterItem) { Random r = new Random(); if (sv == null) { throw new Exception("No ScatterView defined (use Bubble.setScatterView())"); } angle = r.Next(0, 360); id = _id; //ellipse.TouchDown += new EventHandler<TouchEventArgs>(endAnimation); //<Ellipse Fill="Red" Opacity="0.5" Margin="10" TouchDown="endAnimation" /> Image im = new Image(); String path; switch (id) { default: case 0: path = "bullenote.png"; duration = 2; break; case 1: path = "bullecroche.png"; duration = 1; break; case 2: path = "bulleblanche.png"; duration = 4; break; } Grid grid = new Grid(); name = SurfaceWindow1.nbBubble; im.Source = new BitmapImage(new Uri("Images/" + path, UriKind.Relative)); im.IsHitTestVisible = false; im.Height = 60; im.Width = 60; grid.Children.Add(im); Ellipse ellipse = new Ellipse(); ellipse.Fill = System.Windows.Media.Brushes.Red; ellipse.Margin = new Thickness(20); ellipse.Opacity = 0.5; grid.Children.Add(ellipse); svitem = scatterItem; svitem.Background = Brushes.Transparent; svitem.ShowsActivationEffects = false; svitem.Height = 40; svitem.Width = 40; svitem.Content = grid; svitem.Name = "b" + name.ToString(); SurfaceWindow1.nbBubble++; sv.Items.Add(scatterItem); }
//---------------------------------------------------------// /// <summary> /// Called when an add animation is completed. /// </summary> /// <param name="item">The item that was just animated.</param> private static void OnAddAnimationCompleted(ScatterViewItem item) { // When the animation completes, the animation will no longer be the determining factor for the layout // of the item, it will revert to the value with the nextmost precedence. In this case, it will be the // values assigned to the item's center and orientation. Set those values to their current values (while // the item is still under animation) so that when the animation completes, the item won't appear to jump. item.Center = item.ActualCenter; item.Orientation = item.ActualOrientation; }
private void AddLibContainer() { ScatterViewItem NewSVI = new ScatterViewItem(); NewSVI.Width = 500; NewSVI.Height = 300; NewSVI.Content = LibCont; LibScatterView.Items.Add(NewSVI); }
void AddLibBar() { ScatterViewItem libbarscatterview = new ScatterViewItem(); libbarscatterview.Width = 500; libbarscatterview.Height = 250; libbarscatterview.Content = LibBar; LibScatterView.Items.Add(libbarscatterview); //TopImageDockPanel.Children.Add(libbarscatterview); }
void tracker_DeviceRemoved(object sender, TrackerEventArgs e) { if (!DialogExitActive) { DialogExitActive = true; ScatterViewItem control; if (sender.GetType().Name.Equals("MinimizedControl")) { control = ((ScatterViewItem)e.Device.MinControl.Parent); } else { control = ((ScatterViewItem)e.Device.Control.Parent); } control.ContactLeave += new ContactEventHandler(control_ContactLeave); DialogExitSvi = new ScatterViewItem(); DialogExitSvi.CanMove = false; DialogExitSvi.CanRotate = false; DialogExitSvi.CanScale = false; DialogExitSvi.Orientation = 0; DialogExitSvi.Width = 120; DialogExitSvi.Height = 65; //DialogExitSvi.Center = new System.Windows.Point(200, 200); DialogExitSvi.Background = System.Windows.Media.Brushes.Transparent; DialogExitSvi.BorderBrush = System.Windows.Media.Brushes.Transparent; DialogExitSvi.SetResourceReference(StyleProperty, "ScatterViewItemStyleInvisible"); MainSV.Items.Add(DialogExitSvi); //DialogExitSvi.Visibility = Visibility.Hidden; Dialog dialog = new Dialog(); DialogExitSvi.Content = dialog; dialog.Question = "Exit application?"; DialogExitSvi.Center = new System.Windows.Point(control.Center.X, control.Center.Y); //DialogExitSvi.Visibility = Visibility.Visible; Storyboard story = DialogExitSvi.Center.X > 924 ? SetStoryTarget("showDialogLeft", DialogExitSvi) : SetStoryTarget("showDialog", DialogExitSvi); story.Begin(this); Action hideItem = delegate { dialog.Freeze(); Storyboard endStory = SetStoryTarget("hideDialog", DialogExitSvi); endStory.Completed += delegate { MainSV.Items.Remove(DialogExitSvi); DialogExitActive = false; }; endStory.Begin(this); }; dialog.No += delegate { hideItem(); }; dialog.Yes += delegate { hideItem(); RemoveDevice(sender, e); }; } }
/// <summary> /// Constructer with scatterViewItem, imageName and owner /// </summary> public ImageItem(ScatterViewItem svi, string imageName, string owner) { this.svi = svi; this.imageName = imageName; this.owner = owner; string[] ownerArray = new string[3]; ownerArray[0] = owner; }
public void newScatterViewItem_SizeChanged(object sender, RoutedEventArgs e) { ScatterViewItem Obj = sender as ScatterViewItem; if (Obj.Width <= 120 || Obj.Height <= 120) { Obj.Visibility = Visibility.Collapsed; } }
/// Will be used when the user touches an element on the scatterview /// will gather the required data for the drag and drop operation and start it /// Once user has dropped item, either a DragCanceled or DragCompleted event will be fired, /// depending on where the item is dropped /// If they drop the item on the ScatterView or LibraryContainer the DragCompleted Event will fire /// If they drop it to the left of the right of the LibraryContainer the DragCanceled event will fire private void Scatter_PreviewTouchDown(object sender, TouchEventArgs e) { FrameworkElement findSource = e.OriginalSource as FrameworkElement; ScatterViewItem draggedElement = null; //find the ScatterViewItem object that is being touched while (draggedElement == null && findSource != null) { if ((draggedElement = findSource as ScatterViewItem) == null) { findSource = VisualTreeHelper.GetParent(findSource) as FrameworkElement; } } if (draggedElement == null) { return; } PhotoData data = draggedElement.Content as PhotoData; //create the cursor visual ContentControl cursorVisual = new ContentControl() { Content= draggedElement.DataContext, Style = FindResource("CursorStyle") as Style }; //create the list of input devices //add the touches that are currently captured within the dragged elt and //the current touch (if it isn't already in the list) List<InputDevice> devices = new List<InputDevice>(); devices.Add(e.TouchDevice); foreach (TouchDevice touch in draggedElement.TouchesCapturedWithin) { if (touch != e.TouchDevice) { devices.Add(touch); } } //get the drag source object ItemsControl dragSource = ItemsControl.ItemsControlFromItemContainer(draggedElement); //the scatterview object that the cursor is dragged out from SurfaceDragDrop.BeginDragDrop( dragSource, draggedElement, cursorVisual, draggedElement.DataContext, devices, DragDropEffects.Move); //this prevents the default touch operator from happening e.Handled = true; //hide the scatterviewitem for now. we will remove it if the dragdrop is successful draggedElement.Visibility = Visibility.Hidden; }
public static ScatterViewItem WrapWithScatterItem(UserControl uc, int w, int h) { ScatterViewItem result = new ScatterViewItem(); result.Content = uc; result.Width = w; result.Height = h; return(result); }
public Chip(ScatterViewItem chip, double betControlLine, double xChip, double yChip, int chipValue, Uri imagePath) { this.chip = chip; this.betControlLine = betControlLine; this.xChip = xChip; this.yChip = yChip; this.chipValue = chipValue; this.imagePath = imagePath; }
//will restore the scatterviewitem to visible when the user drops the item where it is not able //to be dropped private void Scatter_DragCanceled(object sender, SurfaceDragDropEventArgs e) { PhotoData data = e.Cursor.Data as PhotoData; ScatterViewItem svi = scatter.ItemContainerGenerator.ContainerFromItem(data) as ScatterViewItem; if (svi != null) { svi.Visibility = Visibility.Visible; } }
public WebStack(ScatterView sv, Point origin, WebGroup gr, String group, KnowledgeWeb knowledge, LADSArtworkMode.ArtworkModeWindow art, int g) { groupNo = g; artwork = art; kw = knowledge; _sv = sv; _images = gr.getGroupBitmap(group); if (_images == null) return; foreach (BitmapImage i in _images) { ScatterViewItem svi = new ScatterViewItem(); svi.MinHeight = 1; svi.MinWidth = 1; Image img = new Image(); img.Source = i; sviContent content = new sviContent(); content.g = new Grid(); content.g.Height = INITIAL_THUMB_HEIGHT; content.g.Width = INITIAL_THUMB_HEIGHT; content.im = img; content.r = new Rectangle(); content.r.Height = INITIAL_THUMB_HEIGHT; content.r.Width = INITIAL_THUMB_HEIGHT; content.r.Visibility = Visibility.Collapsed; content.g.Children.Add(content.r); content.g.Children.Add(content.im); content.used = false; svi.Content = content.g; svi.Tag = content; svi.Height = INITIAL_THUMB_HEIGHT; svi.Width = INITIAL_THUMB_HEIGHT; svi.Orientation = 0; svi.CanRotate = false; svi.CanMove = false; svi.CanScale = false; svi.PreviewTouchUp += new EventHandler<System.Windows.Input.TouchEventArgs>(svi_PreviewTouchUp); svi.PreviewTouchDown += new EventHandler<TouchEventArgs>(svi_PreviewTouchDown); svi.SizeChanged += new SizeChangedEventHandler(svi_SizeChanged); knowledge.sviList.Add(svi); _svis.Add(svi); _sv.Items.Add(svi); } PositionScatterViewItems(origin); }
public void CheckPosition() { int minX = 0 + 35; int minY = 0 + 70; int maxX = 1024 - 35; int maxY = 768 - 70; bool IsInCorner = false; ScatterViewItem item = (ScatterViewItem)this.Parent; double newX = item.Center.X, newY = item.Center.Y; if (item.Center.X < minX) // left edge { newX = minX; if (item.Center.Y < minY) // top left corner { newY = minY; IsInCorner = true; } if (item.Center.Y > maxY) // bottom left corner { newY = maxY; IsInCorner = true; } } else if (item.Center.X > maxX) //right edge { newX = maxX; if (item.Center.Y < minY) // top right corner { newY = minY; IsInCorner = true; } if (item.Center.Y > maxY) // bottom right corner { newY = maxY; IsInCorner = true; } } else if (item.Center.Y < minY) // top edge { newY = minY; } else if (item.Center.Y > maxY) // bottom edge { newY = maxY; } item.Center = new Point(newX, newY); if (IsInCorner) { Disconnected(this, new TrackerEventArgs(device, TrackerEventType.Removed)); Logger.Log("exit", "off corner"); } }
void container_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { GenericIdeationObjects.IdeationUnit associatedIdea = (GenericIdeationObjects.IdeationUnit) this.Tag; ScatterViewItem container = (ScatterViewItem)sender; if (noteUITranslatedEventHandler != null) { noteUITranslatedEventHandler(this, (GenericIdeationObjects.IdeationUnit) this.Tag, (float)container.Center.X, (float)container.Center.Y); } }
public void AddLibraryStack() { ScatterViewItem NewSVI = new ScatterViewItem(); NewSVI.Width = 300; NewSVI.Name = "LibStackSVI"; NewSVI.Height = 300; NewSVI.Background = new SolidColorBrush(Colors.Transparent); NewSVI.Content = LibStack; LibScatterView.Items.Add(NewSVI); }
private void OnViewLoaded(object sender, RoutedEventArgs e) { this.view.Loaded -= this.OnViewLoaded; ScatterViewItem host = VisualTreeHelperEx.FindParent <ScatterViewItem>(this.view); if (host == null) { throw new ArgumentNullException("The view is not wrapped by a ScatterViewItem, is it hosted inside a ScatterView?"); } host.InteractiveElement = this.view.DataContext as IInteractiveElement; }
//Determines stopping/out of bounds conditions for manipulation of the shutter private void Level1_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e) { ScatterViewItem L1 = (ScatterViewItem)sender; //If its center is ever higher than its highest point, lower than its lowest point, or less than 50 higher than L2's center if ((L1.Center.Y < high.Y) || (L1.Center.Y > low.Y) || (L1.Center.Y > (sw1.L2.Center.Y - snapThreshold_L2))) { L1.CancelManipulation(); } L1.Center = new Point(low.X, L1.Center.Y); }
private void TagVisualization3_Loaded(object sender, RoutedEventArgs e) { //TODO: customize TagVisualization3's UI based on this.VisualizedTag here base.OnInitialized(e); // Query the registry to find out where the sample media is stored. const string shellKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\Shell Folders"; string videosPath = (string)Microsoft.Win32.Registry.GetValue(shellKey, "CommonVideo", null) + @"\Sample Videos"; // The name of the video. string targetVideo = @"C:\Users\hcilab\Desktop\Polina\CS320HW2Media\greece.mp4"; // string targetVideo = @"Wildlife.wmv"; // Create a ScatterViewItem control and add it to the Items collection. ScatterViewItem item = new ScatterViewItem(); videoScatter.Items.Add(item); // Create a MediaElement object. MediaElement video = new MediaElement(); video.LoadedBehavior = MediaState.Manual; video.UnloadedBehavior = MediaState.Manual; // The media dimensions are not available until the MediaOpened event. video.MediaOpened += delegate { // Size the ScatterViewItem control according to the video size. item.Height = video.NaturalVideoHeight / 2; item.Width = video.NaturalVideoWidth / 2; }; // Set the Content to the video. item.Content = video; // Get the video if it exists. if (System.IO.File.Exists(targetVideo)) { video.Source = new Uri(targetVideo); video.Play(); } else { item.Content = "Video not found"; } }
public static void RemoveShadow(ScatterViewItem tool) { RoutedEventHandler loadedEventHandler = null; loadedEventHandler = new RoutedEventHandler(delegate { tool.Loaded -= loadedEventHandler; Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc; ssc = tool.Template.FindName("shadow", tool) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome; ssc.Visibility = Visibility.Hidden; }); tool.Loaded += loadedEventHandler; }
public RealPrimerBlastUC(List<ResultSVI> resultList, int totalBasePairs) { InitializeComponent(); scoreGen = new Random(88); startGen = new Random(315); stopGen = new Random(12); this.totalBasePairs = totalBasePairs; //int i = _maxResult; //while (i > 0) Console.WriteLine(resultList.Count); for (int i = 0; i < resultList.Count; i++) { Console.WriteLine(i); //BlastPrimerResult bpr = new BlastPrimerResult(scoreGen.Next(0,100), startGen.Next(0, 999), stopGen.Next(1024)); //faking //float scoreGenFloat = scoreGen.Next(80, 100); //float startGenFloat = startGen.Next(0, 1016); //adding back end ResultSVI result = resultList[i]; double scoreGenFloat = result.GetScore(); double startGenFloat = result.GetHitStart(); _maxResult--; if (i<7) { RealBlastPrimerResult bpr = new RealBlastPrimerResult(result, _maxResult, totalBasePairs); bpr.ScatterManipulationStarted += new ScatterManipulationStartedEventHandler(bpr_ScatterManipulationStarted); Momma.Items.Add(bpr); ScatterViewItem matchMark = new ScatterViewItem(); matchMark.Width = 5; matchMark.MinWidth = 5; matchMark.Height = 100; matchMark.Center = new Point(bpr.Center.X, 50); matchMark.Background = Brushes.Yellow; matchMark.IsTopmostOnActivation = false; matchMark.ShowsActivationEffects = false; matchMark.CanMove = false; matchMark.CanRotate = false; matchMark.CanScale = false; Momma.Items.Add(matchMark); } //i--; } }
private void MergeBetween(ScatterViewItem sviChild, ScatterViewItem sviSource) { //merge the colors and assign it to the remaining SVI //expanded for readibility SolidColorBrush scb1 = sviSource.Background as SolidColorBrush; SolidColorBrush scb2 = sviChild.Background as SolidColorBrush; sviChild.Background = new SolidColorBrush(Color.Add(scb1.Color, scb2.Color)); _scatter.Items.Remove(sviSource); //No need to continue, exit out. return; }
public Bubble(int _id, ScatterViewItem scatterItem) { Random r = new Random(); if (sv == null) throw new Exception("No ScatterView defined (use Bubble.setScatterView())"); angle = r.Next(0, 360); id = _id; //ellipse.TouchDown += new EventHandler<TouchEventArgs>(endAnimation); //<Ellipse Fill="Red" Opacity="0.5" Margin="10" TouchDown="endAnimation" /> Image im = new Image(); String path; switch (id) { default: case 0: path = "bullenote.png"; duration = 2; break; case 1: path = "bullecroche.png"; duration = 1; break; case 2: path = "bulleblanche.png"; duration = 4; break; } Grid grid = new Grid(); name = SurfaceWindow1.nbBubble; im.Source = new BitmapImage(new Uri("Images/" + path, UriKind.Relative)); im.IsHitTestVisible = false; im.Height = 60; im.Width = 60; grid.Children.Add(im); Ellipse ellipse = new Ellipse(); ellipse.Fill = System.Windows.Media.Brushes.Red; ellipse.Margin = new Thickness(20); ellipse.Opacity = 0.5; grid.Children.Add(ellipse); svitem = scatterItem; svitem.Background = Brushes.Transparent; svitem.ShowsActivationEffects = false; svitem.Height = 40; svitem.Width = 40; svitem.Content = grid; svitem.Name = "b"+name.ToString(); SurfaceWindow1.nbBubble++; sv.Items.Add(scatterItem); }
protected override void OnViewLoaded(object view) { base.OnViewLoaded(view); mdv = (MapDashboardView)view; svi = (ScatterViewItem)Helpers.FindElementOfTypeUp(mdv, typeof(ScatterViewItem)); //if (_fe.Style == null) _fe.Style = this.FindResource("DefaultContainerStyle") as Style; svi.ContainerManipulationDelta += (e, f) => { UpdateMap(); }; UpdateMap(); }
/// <summary> /// Factory method. Creates ScatterViewItemViews of items out from given ls /// </summary> /// <param name="ls"></param> /// <param name="deviceName"></param> /// <param name="startingPosition"></param> /// <returns></returns> public ScatterViewItem[] createFileList(ArrayList ls, String deviceName) { ls.TrimToSize(); ScatterViewItem[] items = new ScatterViewItem[ls.Count]; for (int i = 0; i < ls.Count; i++) { IndexObject item = ls[i] as IndexObject; ScatterViewItem temp = this.getItemView(item, deviceName); if (temp != null) { items[i] = temp; } } return items; }
/// <summary> /// Adds a new web browser to the scatter control /// </summary> public void NewWebBrowser() { OurWebBrowser wb = new OurWebBrowser(); ScatterViewItem item = new ScatterViewItem() { Width = 800, Height = 700, Content = wb }; _webBrowsers.Add(wb); _scatterView.Items.Add(item); //watch for the save button wb.OnSaved += new EventHandler(wb_OnSaved); }
private void ButtonAddItem_Click(object sender, RoutedEventArgs e) { var item = new ScatterViewItem(); item.ContainerManipulationCompleted += item_ContainerManipulationCompleted; item.ContainerManipulationStarted += item_ContainerManipulationStarted; item.ContainerManipulationDelta += item_ContainerManipulationDelta; item.BorderBrush = PlayGround.BorderBrush; item.AngularDeceleration = 0.00001; item.Deceleration = 0.01; item.BorderThickness = new Thickness(2d); item.Content = "My toy"; PlayGround.Items.Add(item); ResetItem(item); LabelStatus.Content = ""; item.Content = new Ellipse() { Fill = Brushes.Aqua }; }
/// <summary> /// Check if the item is touching the border of the playground /// </summary> /// <param name="item"></param> /// <returns></returns> private bool ItemIsOutsideView(ScatterViewItem item) { double verticalOffset = item.ActualHeight / 2; double horizontalOffset = item.ActualWidth / 2; Point p1 = new Point(item.ActualCenter.X, item.ActualCenter.Y); p1.Offset(horizontalOffset, verticalOffset); if (PointIsOutsideView(p1)) { return true; } p1 = new Point(item.ActualCenter.X, item.ActualCenter.Y); p1.Offset(-horizontalOffset, -verticalOffset); if (PointIsOutsideView(p1)) { return true; } return false; }
/// <summary> /// Constructor /// Create un NoteViewModel /// </summary> /// <param name="center">The center point of the ScatterViewItem </param> /// <param name="n">The note in the NoteViewModel</param> /// <param name="sv">The ScatterView Parent (here, SessionVM.Notes)</param> /// <param name="s">The current SessionViewModel</param> public NoteViewModel(Point center, Note n, ScatterView sv, SessionViewModel s) : base(s) { Note = n; SVItem = new ScatterViewItem(); ParentSV = sv; SVItem.Center = center; SVItem.CanScale = false; SVItem.HorizontalAlignment = HorizontalAlignment.Center; SVItem.CanRotate = false; SVItem.HorizontalAlignment = HorizontalAlignment.Center; SetStyle(); Animation = new NoteAnimation(this, SessionVM); }
private void scatterviewMomma_ContactDown(object sender, ContactEventArgs e) { ScatterViewItem svi = new ScatterViewItem(); svi.Background = Brushes.Tomato; svi.Height = 300; svi.Width = 300; //DoubleAnimation animation = new DoubleAnimation(); //animation.To = 0; //animation.Duration = new Duration(new TimeSpan(0, 0, 5)); //Storyboard sb = new Storyboard(); //sb.Children.Add(animation); //Storyboard.SetTarget(sb, svi); //Storyboard.SetTargetProperty(sb, new PropertyPath(Control.ActualHeightProperty)); //sb.Begin(); ScatterView temp = (ScatterView) scatterviewMomma.Parent; }
/// <summary> /// NoteBubbleViewModel Constructor. /// </summary> public MelodyBubbleViewModel(MelodyBubble mb, ScatterView sv, SessionViewModel s) : base(s) { MelodyBubble = mb; SVItem = new ScatterViewItem(); ParentSV = sv; Random r = new Random(); SVItem.Center = new Point(r.Next((int)sv.ActualWidth), r.Next((int)(635 * sv.ActualHeight / 1080), (int)sv.ActualHeight)); SVItem.CanScale = false; SVItem.HorizontalAlignment = HorizontalAlignment.Center; SVItem.CanRotate = false; SVItem.HorizontalAlignment = HorizontalAlignment.Center; FrameworkElementFactory bubbleImage = new FrameworkElementFactory(typeof(Image)); bubbleImage.SetValue(Image.SourceProperty, new ThemeViewModel(SessionVM.Session.Theme, SessionVM).GetMelodyBubbleImageSource(mb.Melody.gesture)); bubbleImage.SetValue(Image.IsHitTestVisibleProperty, false); bubbleImage.SetValue(Image.WidthProperty, (135.0 / 1920.0) * SessionVM.SessionSVI.ActualWidth); bubbleImage.SetValue(Image.HeightProperty, (135.0 / 1080.0) * SessionVM.SessionSVI.ActualHeight); FrameworkElementFactory touchZone = new FrameworkElementFactory(typeof(Ellipse)); touchZone.SetValue(Ellipse.FillProperty, Brushes.Transparent); touchZone.SetValue(Ellipse.MarginProperty, new Thickness(15)); FrameworkElementFactory grid = new FrameworkElementFactory(typeof(Grid)); grid.AppendChild(bubbleImage); grid.AppendChild(touchZone); ControlTemplate ct = new ControlTemplate(typeof(ScatterViewItem)); ct.VisualTree = grid; Style bubbleStyle = new Style(typeof(ScatterViewItem)); bubbleStyle.Setters.Add(new Setter(ScatterViewItem.TemplateProperty, ct)); SVItem.Style = bubbleStyle; Animation = new MelodyBubbleAnimation(this, SessionVM); }
private void ImageViewLoaded(object sender, RoutedEventArgs e) { try { rt = new DispatcherTimer(); rt.Interval = new TimeSpan(0,0,0,0,100); rt.Tick += rt_Tick; rt.Start(); dt = new DispatcherTimer(); dt.Interval = new TimeSpan(0, 0, 0, 10); dt.Tick += dt_Tick; if ((DataContext as ImageFolderViewModel) != null) SelectedImage = (DataContext as ImageFolderViewModel).Doc.Location; var i = Directory.GetFiles(SelectedImage).ToList(); List<FileInfo> fi = new List<FileInfo>(); i.ForEach(k => fi.Add(new FileInfo(k))); Images = fi.OrderBy(k=>k.CreationTime).Select(k=>k.FullName).ToList(); if (Images.Count > 0) { SelectedImage = Images.First(); _svi = (ScatterViewItem) Helpers.FindElementOfTypeUp(this, typeof (ScatterViewItem)); LoadImage(); if (_svi != null && _svi.DataContext is FloatingElement) { _svi.SizeChanged += SviSizeChanged; _svi.ContainerActivated += _svi_ContainerActivated; _svi.MouseMove += _svi_MouseEnter; } } } catch (Exception es) { Logger.Log("Image View", es.Message, "", Logger.Level.Error); } }
//Browser Code private void BuildBrowserInScatterView(string s, ScatterView scatterview) { ScatterViewItem svi = new ScatterViewItem(); Grid addition = new Grid(); CustomBrowser webBrower = new CustomBrowser(); webBrower.scatter = scatterview; webBrower.Width = double.NaN; //set it for auto width webBrower.Height = double.NaN; webBrower.Source = new Uri(s); webBrower.ShowCreatedWebView += new ShowCreatedWebViewEventHandler(webBrower_ShowCreatedWebView); //newItem.Margin = new Thickness(25.0, 25.0, 25.0, 25.0); svi.Padding = new Thickness(25.0, 25.0, 25.0, 25.0); //newItem.Content = webBrower; WrapPanel wrap = new WrapPanel(); wrap.Orientation = System.Windows.Controls.Orientation.Vertical; //wrap.Children.Add(new SurfaceTextBox()); wrap.Children.Add(webBrower); addition.Children.Add(wrap); svi.Content = addition; //Sets the new grid as the SVI content //ElementMenuItem check = (ElementMenuItem)sender; scatterview.Items.Add(svi); ElementMenu menu = new ElementMenu(); menu.ActivationHost = svi; menu.ActivationMode = ElementMenuActivationMode.HostInteraction; ElementMenuItem emi = new ElementMenuItem(); emi.Header = "Close"; emi.Click += new RoutedEventHandler(ElementCloseMenuItem_Click); menu.Items.Add(emi); menu.VerticalAlignment = System.Windows.VerticalAlignment.Top; menu.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; addition.Children.Add(menu); //adds ElementMenu to the grid }
//"*.asgproj" public LoadDialog(SessionManager _sessionManager, Main _instance,List<string> _filter, LoadDialogType _type, ScatterViewItem svi = null) { InitializeComponent(); sessionManager = _sessionManager; instance = _instance; type = _type; DirectoryInfo di = null; switch (type) { case LoadDialogType.Project: di = new DirectoryInfo(EnvironmentFolder.getProjectsFolder()); LoadButton.Click += LoadProjectButton_Click; Title.Content = "LOAD PROJECT"; break; case LoadDialogType.BackgroundImage: di = new DirectoryInfo(EnvironmentFolder.getImagesFolder()); LoadButton.Click += LoadImageButton_Click; Title.Content = "BACKGROUND IMAGE"; break; case LoadDialogType.GestureAreaImage: di = new DirectoryInfo(EnvironmentFolder.getImagesFolder()); Svi = svi; LoadButton.Click += LoadImageGestureAreaButton_Click; Title.Content = "GESTURE AREA IMAGE"; break; } ProjectList.Items.Clear(); foreach (string s in _filter) { FileInfo[] rgFiles = di.GetFiles(s); foreach (FileInfo fi in rgFiles) { ProjectList.Items.Add(fi.Name); } } }
public TangramShape(int id, ScatterViewItem motherPiece, List<ScatterViewItem> locations, List<ScatterViewItem> pieces, int level) { this.motherPiece = motherPiece; this.locations = locations; this.pieces = pieces; this.level = level; this.id = id; if (this.level == 1) { Path p = (Path)this.motherPiece.Content; p.Fill = new SolidColorBrush(Colors.Green); foreach (ScatterViewItem s in this.pieces) { Path pp = (Path)s.Content; pp.Fill = new SolidColorBrush(Colors.Green); } } else if (this.level == 2) { Path p = (Path)this.motherPiece.Content; p.Fill = new SolidColorBrush(Colors.Blue); foreach (ScatterViewItem s in this.pieces) { Path pp = (Path)s.Content; pp.Fill = new SolidColorBrush(Colors.Blue); } } else if (this.level == 3) { Path p = (Path)this.motherPiece.Content; p.Fill = new SolidColorBrush(Colors.Red); foreach (ScatterViewItem s in this.pieces) { Path pp = (Path)s.Content; pp.Fill = new SolidColorBrush(Colors.Red); } } }
/// <summary> /// transform a list of coordinate in a scatterviewitem /// </summary> /// <param name="coord"></param> public ScatterViewItem createScatterViewItem(List<int> coord) { ScatterViewItem myShape = new ScatterViewItem(); //create the pathGeometry if (coord != null) { PathFigure myPathFigure = new PathFigure(); myPathFigure.StartPoint = new Point(coord[0], coord[1]); PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection(); for (int i = 2; i < coord.Count(); i = i + 2) { LineSegment myLineSegment = new LineSegment(); myLineSegment.Point = new Point(coord[i], coord[i + 1]); myPathSegmentCollection.Add(myLineSegment); } myPathFigure.Segments = myPathSegmentCollection; PathFigureCollection myPathFigureCollection = new PathFigureCollection(); myPathFigureCollection.Add(myPathFigure); PathGeometry myPathGeometry = new PathGeometry(); myPathGeometry.Figures = myPathFigureCollection; //create the path System.Windows.Shapes.Path myPath = new System.Windows.Shapes.Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; myPath.Data = myPathGeometry; myPath.Fill = new SolidColorBrush(Colors.Blue); //create the scatterViewItem myShape.Content = myPath; myShape.Width = this.max(coord); myShape.Height = this.max(coord); } return myShape; }
public void BindScatterViewItemAndElement(ScatterViewItem svi, PrototypeElement element) { svi.Tag = element; PrototypeElement _element = new PrototypeElement() { Width = element.Width, Height = element.Height, Center = element.Center, Orientation = element.Orientation}; Binding elementBindings = new Binding(); elementBindings.Mode = BindingMode.OneWayToSource; elementBindings.Source = element; elementBindings.Path = new PropertyPath("Width"); svi.SetBinding(ScatterViewItem.WidthProperty, elementBindings); elementBindings = new Binding(); elementBindings.Mode = BindingMode.OneWayToSource; elementBindings.Source = element; elementBindings.Path = new PropertyPath("Height"); svi.SetBinding(ScatterViewItem.HeightProperty, elementBindings); elementBindings = new Binding(); elementBindings.Mode = BindingMode.OneWayToSource; elementBindings.Source = element; elementBindings.Path = new PropertyPath("Center"); svi.SetBinding(ScatterViewItem.CenterProperty, elementBindings); elementBindings = new Binding(); elementBindings.Mode = BindingMode.OneWayToSource; elementBindings.Source = element; elementBindings.Path = new PropertyPath("Orientation"); svi.SetBinding(ScatterViewItem.OrientationProperty, elementBindings); if (element != null) { svi.Width = _element.Width; svi.Center = _element.Center; svi.Height = _element.Height; svi.Orientation = _element.Orientation; } }
/// <summary> /// Default constructor. /// </summary> public SurfaceWindow1() { InitializeComponent(); // Add handlers for Application activation events AddActivationHandlers(); List<string> l = DummyData.GetDemoData(); int i = 0; foreach (string s in l) { ScatterViewItem svi = new ScatterViewItem(); svi.Content = s; svi.Tag = i & 0xFFFFFFFE; P4Helper.Log("Tag of " + s + " = " + svi.Tag); if (i % 2 == 1) svi.Background = Brushes.Aqua; else svi.Background = Brushes.Beige; svi.MouseDown += new MouseButtonEventHandler(label_MouseDown); svi.ScatterManipulationCompleted += new ScatterManipulationCompletedEventHandler(svi_ScatterManipulationCompleted); MyScatterView.Items.Add(svi); i++; } }