public static OutlinerColumn CreateColumnClass(OutlinerNote note, OutlinerColumnDefinition definition) { switch (definition.DataType) { case ColumnDataType.RichText: return(new RichTextColumn(note)); default: return(null); } }
public static OutlinerColumn CreateColumnClass(OutlinerNote note, OutlinerColumnDefinition definition) { switch (definition.DataType) { case ColumnDataType.RichText: return new RichTextColumn(note); default: return null; } }
private void AddColumnToDocument(string columnName, ColumnDataType columnType) { int id = Document.ColumnDefinitions.Count; OutlinerColumnDefinition definition = new OutlinerColumnDefinition(columnName, columnType); Document.ColumnDefinitions.Add(definition); OutlinerDocument.WalkRecursively(Document.FakeRootNode, delegate(OutlinerNote note, out bool shouldWalkSubItems, out bool shouldContinue) { note.CreateMissingColumns(); shouldContinue = true; shouldWalkSubItems = true; }); AddColumnBinding(definition, id); AdjustColumnSizes(); OutlinerTree.HeaderVisible = (__OutlinerTreeColumns.Count > 1) ? Visibility.Visible : Visibility.Collapsed; }
private void AddColumnBinding(OutlinerColumnDefinition definition, int columnId) { GridViewColumn newColumn = new GridViewColumn(); if (columnId == 0) newColumn.CellTemplate = (DataTemplate)FindResource("CellTemplate_Name"); else newColumn.CellTemplate = ColumnHelpers.TemplateForColumn(this, columnId, definition.DataType); Binding bnd = new Binding("ColumnName"); bnd.Source = definition; BindingOperations.SetBinding(newColumn, GridViewColumn.HeaderProperty, bnd); bnd = new Binding("Width"); bnd.Source = definition; bnd.Mode = BindingMode.TwoWay; BindingOperations.SetBinding(newColumn, GridViewColumn.WidthProperty, bnd); __OutlinerTreeColumns.Add(newColumn); definition.GridViewColumn = newColumn; }
private static void SaveColumnDefinition(XmlWriter wr, OutlinerColumnDefinition columnDefinition) { wr.WriteStartElement("ColumnDefinition"); wr.WriteAttributeString("Name", columnDefinition.ColumnName); wr.WriteAttributeString("Type", ((int)columnDefinition.DataType).ToString()); wr.WriteAttributeString("Width", (columnDefinition.Width).ToString()); wr.WriteEndElement(); }
private static void ReadColumnDefinitions(OutlinerDocument document, XmlReader reader) { string order = reader.GetAttribute("Order"); if (order != null) document.ColumnDefinitions.OrderOnInit = order; document.ColumnDefinitions.Clear(); XmlReader subtree = reader.ReadSubtree(); while (subtree.ReadToFollowing("ColumnDefinition")) { string name = reader.GetAttribute("Name"); ColumnDataType type = (ColumnDataType)int.Parse(reader.GetAttribute("Type")); double width = 100; string width_str = reader.GetAttribute("Width"); try { width = double.Parse(width_str); } catch { if (width_str.Contains(".")) width = double.Parse(reader.GetAttribute("Width").Replace(".", ",")); else if (width_str.Contains(",")) width = double.Parse(reader.GetAttribute("Width").Replace(",", ".")); } if (name != null) { OutlinerColumnDefinition columnDefinition = new OutlinerColumnDefinition(name, type); columnDefinition.Width = width; document.ColumnDefinitions.Add(columnDefinition); } } }