protected override System.Web.UI.Control AddEditor(Control container) { ImageGalleryControl c = new ImageGalleryControl(); container.Controls.Add(c); return(c); }
public ImageGalleryViewModel() { ImagesCollection = new ImageCollection(); _galleryView = new ImageGalleryControl { DataContext = this }; _detailView = new ImageDetailControl { DataContext = this }; CurrentView = _galleryView; }
public override void UpdateEditor(global::N2.ContentItem item, Control editor) { LinkItemCollection coll = LinkItemCollection.FindByPageAndPropertyName(item, Name); ImageGalleryControl ctrl = ((ImageGalleryControl)editor); IDynamicImageUtility dynamicImageUtility = GetDynamicImageUtility(); //Need to convert the ImageItem objects to ImageGalleryItemEditDTO objects List <ImageGalleryItemEditDTO> lstImageGalleryItemEditDTO = coll.Cast <ImageItem>().Select(x => { var dto = ImageGalleryAutoMapperMappings.Instance.Map <ImageGalleryItemEditDTO>(x); dto.ThumbnailUrl = VirtualPathUtility.ToAppRelative(dynamicImageUtility.GenerateVirtualPath(dto.Url, new DynamicImageOptions(dto.Url, 150, 150, DynamicResizeMode.UniformFill, DynamicImageFormat.Jpeg))); return(dto); }).ToList(); ctrl.Initialize(JsonConvert.SerializeObject(lstImageGalleryItemEditDTO), coll.Count); }