private object CreateOutput(object[] data, double x, double y, bool snap) { if (data == null || data.Length != 2) { return(null); } int id = (int)data[0]; int tagId = (int)data[1]; var thumb = new ElementThumb() { Template = Application.Current.Resources[ResourceConstants.KeyTemplateOutput] as ControlTemplate, Style = Application.Current.Resources[ResourceConstants.KeySyleRootThumb] as Style, Uid = Constants.TagElementOutput + Constants.TagNameSeparator + id.ToString() }; SetThumbEvents(thumb); SetPosition(thumb, x, y, snap); var tags = this.GetTags(); if (tags != null) { var tag = tags.Cast <Tag>().Where(t => t.Id == tagId).FirstOrDefault(); if (tag != null) { ElementThumb.SetData(thumb, tag); } } return(thumb); }
private void UpdateSelectedElementTag() { var tag = TagList.SelectedItem as Tag; var item = SelectedList.SelectedItem; if (item != null) { var tuple = item as Tuple <FrameworkElement>; var element = tuple.Item1; ElementThumb.SetData(element, tag); } }