/// <summary> /// Inits the template. /// </summary> protected virtual void InitTemplate() { Template = Application.Current.Resources["PIM_ClassTemplate"] as ControlTemplate; ApplyTemplate(); PIM_ClassTemplate gr = Template.FindName("ClassGrid", this) as PIM_ClassTemplate; if (gr != null) { AttributesSection = gr.FindName("AttributesSection") as StackPanel; OperationsSection = gr.FindName("OperationsSection") as StackPanel; PropertiesBorder = gr.FindName("AttributesBorder") as Border; MethodsBorder = gr.FindName("OperationsBorder") as Border; HeaderBorder = gr.FindName("headerBorder") as Border; txtClassName = gr.FindName("txtClassName") as EditableTextBox; resizeDecorator = gr.FindName("ResizeDecorator") as Control; } else { Debug.Assert(false, "Template not found"); } resizeDecorator.ApplyTemplate(); Grid g = resizeDecorator.Template.FindName("ResizeDecoratorGrid", resizeDecorator) as Grid; foreach (ResizeThumb t in g.Children) { t.belongsTo = this; } connectorDecorator = gr.FindName("ConnectorDecorator") as Control; connectorDecorator.ApplyTemplate(); }
private void InitTemplate() { base.Template = Application.Current.Resources["PSM_ClassTemplate"] as ControlTemplate; ApplyTemplate(); Grid gr = Template.FindName("PSM_ClassGrid", this) as Grid; if (gr != null) { AttributesSection = gr.FindName("AttributesSection") as StackPanel; AttributesBorder = gr.FindName("AttributesBorder") as Border; HeaderBorder = gr.FindName("headerBorder") as Border; ClassBorder = gr.FindName("classBorder") as Border; txtClassName = gr.FindName("txtClassName") as EditableTextBox; txtRepresentedClassName = gr.FindName("txtRepresentedClassName") as EditableTextBox; txtElementNameLabel = gr.FindName("txtElementNameLabel") as EditableTextBox; txtElementNameLabel.CanBeEmpty = true; //resizeDecorator = gr.FindName("ResizeDecorator") as Control; } else { Debug.Assert(false, "Template not found"); } //resizeDecorator.ApplyTemplate(); //Grid g = resizeDecorator.Template.FindName("ResizeDecoratorGrid", resizeDecorator) as Grid; //foreach (ResizeThumb t in g.Children) t.belongsTo = this; connectorDecorator = gr.FindName("ConnectorDecorator") as Control; connectorDecorator.ApplyTemplate(); }
public PSM_ContentContainer(XCaseCanvas xCaseCanvas) : base(xCaseCanvas) { #region Template Init base.Template = Application.Current.Resources["PSM_ContentContainerTemplate"] as ControlTemplate; ApplyTemplate(); PSM_ContentContainerTemplate gr = Template.FindName("PSM_ContentContainerGrid", this) as PSM_ContentContainerTemplate; Border = gr.FindName("Border") as Border; TextBox = gr.FindName("txtName") as EditableTextBox; connectorDecorator = gr.FindName("ConnectorDecorator") as Control; connectorDecorator.ApplyTemplate(); #endregion TextBox.mi_Rename.Header = "Rename content container"; ContextMenuItem m = new ContextMenuItem("Remove content container"); m.Icon = ContextMenuIcon.GetContextIcon("delete2"); m.Click += delegate(object sender, RoutedEventArgs e) { ContentContainerController.Remove(); }; TextBox.ContextMenu.Items.Add(m); ContextMenuItem moveToContentContainer = new ContextMenuItem("Move to content container"); moveToContentContainer.Click += delegate { ContentContainerController.MoveToContentContainer(null); }; TextBox.ContextMenu.Items.Add(moveToContentContainer); ContextMenuItem moveToContentChoice = new ContextMenuItem("Move to content choice"); moveToContentChoice.Click += delegate { ContentContainerController.MoveToContentChoice(null); }; TextBox.ContextMenu.Items.Add(moveToContentChoice); TextBox.ContextMenu.Items.Add(new Separator()); foreach (ContextMenuItem item in ContextMenuItems) { TextBox.ContextMenu.Items.Add(item); } TextBox.TextEdited += delegate(object sender, StringEventArgs args) { Controller.RenameElement <NamedElement>(args.Data, null); XCaseCanvas.InvokeElementSizeChanged(this, null); }; }
public XCaseComment(XCaseCanvas xCaseCanvas) : base(xCaseCanvas) { #region Commentary Template Init Template = (ControlTemplate)Application.Current.Resources["XCaseCommentaryTemplate"]; ApplyTemplate(); XCaseCommentTemplate gr = (XCaseCommentTemplate)Template.FindName("CommentaryGrid", this); if (gr != null) { CommentBorder = gr.FindName("CommentBorder") as Border; CommentTextBox = (EditableTextBox)gr.FindName("txtText"); resizeDecorator = (Control)gr.FindName("ResizeDecorator"); resizeDecorator.ApplyTemplate(); Grid g = (Grid)resizeDecorator.Template.FindName("ResizeDecoratorGrid", resizeDecorator); foreach (ResizeThumb t in g.Children) { t.belongsTo = this; } connectorDecorator = (Control)gr.FindName("ConnectorDecorator"); connectorDecorator.ApplyTemplate(); } #endregion #region Commentary Context Menu ContextMenuItem m = new ContextMenuItem("Remove from diagram"); m.Icon = ContextMenuIcon.GetContextIcon("delete2"); m.Click += new RoutedEventHandler(Remove_Click); CommentTextBox.ContextMenu.Items.Add(m); CommentTextBox.mi_Rename.Header = "Change"; #endregion CommentTextBox.TextEdited += delegate(object sender, StringEventArgs args) { Controller.ChangeComment(args.Data); }; PositionChanged += delegate { CommentTextBox.myEditable = false; }; }
public PSM_DiagramReference(XCaseCanvas xCaseCanvas) : base(xCaseCanvas) { #region Template Init base.Template = Application.Current.Resources["PSM_DiagramReferenceTemplate"] as ControlTemplate; ApplyTemplate(); PSM_DiagramReferenceTemplate gr = Template.FindName("PSM_DiagramReferenceGrid", this) as PSM_DiagramReferenceTemplate; Border = gr.FindName("Border") as Border; TextBox = gr.FindName("txtName") as EditableTextBox; tLocal = gr.FindName("tLocal") as EditableTextBox; tSchemaLocation = gr.FindName("tSchemaLocation") as EditableTextBox; tNamespacePrefix = gr.FindName("tNamespacePrefix") as EditableTextBox; tNamespace = gr.FindName("tNamespace") as EditableTextBox; tReferencedDiagram = gr.FindName("tReferencedDiagram") as EditableTextBox; connectorDecorator = gr.FindName("ConnectorDecorator") as Control; connectorDecorator.ApplyTemplate(); #endregion }