示例#1
0
        /// For Chaning a Width, Height and Strokethickness properties of the LineConnector ,it is apllicable when the LineConnector is selected
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox box = (sender as TextBox);

            if (diagramView != null)
            {
                if (diagramView.SelectionList.Count > 0)
                {
                    foreach (object o in diagramView.SelectionList)
                    {
                        if (o is LineConnector)
                        {
                            LineConnector selectedline = (o as LineConnector);
                            if (box.Text != string.Empty)
                            {
                                switch (box.Name)
                                {
                                case "WidthValue":
                                    if (Head.IsChecked == true)
                                    {
                                        selectedline.HeadDecoratorStyle.Width = double.Parse(box.Text);
                                    }
                                    else if (Tail.IsChecked == true)
                                    {
                                        selectedline.TailDecoratorStyle.Width = double.Parse(box.Text);
                                    }
                                    break;

                                case "HeightValue":
                                    if (Head.IsChecked == true)
                                    {
                                        selectedline.HeadDecoratorStyle.Height = double.Parse(box.Text);
                                    }
                                    else if (Tail.IsChecked == true)
                                    {
                                        selectedline.TailDecoratorStyle.Height = double.Parse(box.Text);
                                    }
                                    break;

                                case "ThicknessValue":
                                    if (Head.IsChecked == true)
                                    {
                                        selectedline.HeadDecoratorStyle.StrokeThickness = double.Parse(box.Text);
                                    }
                                    else if (Tail.IsChecked == true)
                                    {
                                        selectedline.TailDecoratorStyle.StrokeThickness = double.Parse(box.Text);
                                    }
                                    break;
                                }
                            }
                            selectedline.UpdateConnectorPathGeometry();
                        }
                    }
                }
            }
        }