void editor_DataChanged(object sender, EventArgs e) { AdditionalFileEditor editor = (AdditionalFileEditor)sender; editor.AssociatedFile.Description = editor.FileDescription; editor.AssociatedFile.Type = editor.FileType; }
private static void OnIsReadOnlyPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e) { AdditionalFileEditor editor = (AdditionalFileEditor)sender; editor.btnDelete.Visibility = editor.IsReadOnly ? Visibility.Collapsed : Visibility.Visible; editor.comboType.IsEnabled = !editor.IsReadOnly; editor.labelDescription.Visibility = editor.IsReadOnly ? Visibility.Collapsed : Visibility.Visible; editor.textDescription.Visibility = editor.IsReadOnly ? Visibility.Collapsed : Visibility.Visible; }
void file_DeleteClicked(object sender, System.EventArgs e) { AdditionalFileEditor editor = (AdditionalFileEditor)sender; this.Release.AdditionalFiles.Remove(editor.AssociatedFile); this.items.Remove(editor); this.grid.Children.Remove(editor); this.grid.RowDefinitions.RemoveAt(this.grid.RowDefinitions.Count - 1); this.UpdateRows(); }
private AdditionalFileEditor CreateFileEditor() { AdditionalFileEditor editor = new AdditionalFileEditor(); editor.Margin = new Thickness(0, 0, 2, 3); editor.SetBinding(AdditionalFileEditor.IsReadOnlyProperty, new Binding("IsReadOnly") { Source = this }); return(editor); }
private void AddItem(ReleaseAdditionalFile file) { this.grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength() }); AdditionalFileEditor editor = CreateFileEditor(); editor.FileType = file.Type; editor.SetFile(file.OriginalFilename, file.File); editor.FileDescription = file.Description; editor.DeleteClicked += new EventHandler(file_DeleteClicked); editor.AssociatedFile = file; editor.DataChanged += new EventHandler(editor_DataChanged); items.Add(editor); this.grid.Children.Add(editor); this.UpdateRows(); }
private AdditionalFileEditor CreateFileEditor() { AdditionalFileEditor editor = new AdditionalFileEditor(); editor.Margin = new Thickness(0, 0, 2, 3); editor.SetBinding(AdditionalFileEditor.IsReadOnlyProperty, new Binding("IsReadOnly") { Source = this }); return editor; }