public void InsertPicture(int index, EditablePicture picture) { var name = picture.Name.Length > 30 ? picture.Name.Substring(0, 30) + "..." : picture.Name; Items.Insert(index, new PictureItem { Model = picture, IsSelected = true, Header = name }); }
public void AddPicture(EditablePicture picture) { var name = picture.Name.Length > 30 ? picture.Name.Substring(0, 30) + "..." : picture.Name; Items.Add(new PictureItem { Model = picture, IsSelected = true, Header = name }); }
private PictureItem GetPictureItem(EditablePicture model) { foreach (var item in Items) { var pictureItem = item as PictureItem; if (pictureItem?.Model == model) { return(pictureItem); } } return(null); }
public void RemovePicture(EditablePicture picture) { var pictureItem = GetPictureItem(picture); Items.Remove(pictureItem); }