当前位置: 首页>>代码示例>>C#>>正文


C# GridSplitter.SetValue方法代码示例

本文整理汇总了C#中System.Windows.Controls.GridSplitter.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# GridSplitter.SetValue方法的具体用法?C# GridSplitter.SetValue怎么用?C# GridSplitter.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.GridSplitter的用法示例。


在下文中一共展示了GridSplitter.SetValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalArrange

        private void InternalArrange(Grid grid, IPane pane)
        {
            if (pane is UIElement)
            {
                grid.Children.Add(pane as UIElement);
            }
            else if (pane is PaneGroup)
            {
                PaneGroup group = pane as PaneGroup;
                if (group.First.Hidden && !group.Second.Hidden)
                    InternalArrange(grid, group.Second);
                else if (!group.First.Hidden && group.Second.Hidden)
                    InternalArrange(grid, group.First);
                else
                {
                    Grid firstGrid = new Grid();
                    Grid secondGrid = new Grid();

                    if (group.Split == SplitOrientation.Horizontal)
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid.RowDefinitions.Add(new RowDefinition());
                        grid.RowDefinitions.Add(new RowDefinition());

                        grid.RowDefinitions[0].Height = group.First.GridHeight;
                        grid.RowDefinitions[1].Height = group.Second.GridHeight;

                        //if (!grid.RowDefinitions[0].Height.IsStar &&
                        //    !grid.RowDefinitions[1].Height.IsStar)
                        //    grid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);

                        firstGrid.SetValue(Grid.ColumnProperty, 0);
                        firstGrid.SetValue(Grid.RowProperty, 0);
                        secondGrid.SetValue(Grid.ColumnProperty, 0);
                        secondGrid.SetValue(Grid.RowProperty, 1);

                        GridSplitter splitter = new GridSplitter();
                        splitter.VerticalAlignment = VerticalAlignment.Top;
                        splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                        splitter.SetValue(Grid.ColumnProperty, 0);
                        splitter.SetValue(Grid.RowProperty, 1);
                        splitter.Height = 5;
                        secondGrid.Margin = new Thickness(0, 5, 0, 0);

                        grid.Children.Add(firstGrid);
                        grid.Children.Add(splitter);
                        grid.Children.Add(secondGrid);

                        InternalArrange(firstGrid, group.First);
                        InternalArrange(secondGrid, group.Second);
                    }
                    else
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid.RowDefinitions.Add(new RowDefinition());

                        grid.ColumnDefinitions[0].Width = group.First.GridWidth;
                        grid.ColumnDefinitions[1].Width = group.Second.GridWidth;
                        if (!grid.ColumnDefinitions[0].Width.IsStar &&
                            !grid.ColumnDefinitions[1].Width.IsStar)
                            grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);

                        firstGrid.SetValue(Grid.ColumnProperty, 0);
                        firstGrid.SetValue(Grid.RowProperty, 0);
                        secondGrid.SetValue(Grid.ColumnProperty, 1);
                        secondGrid.SetValue(Grid.RowProperty, 0);

                        GridSplitter splitter = new GridSplitter();
                        splitter.VerticalAlignment = VerticalAlignment.Stretch;
                        splitter.HorizontalAlignment = HorizontalAlignment.Left;
                        splitter.SetValue(Grid.ColumnProperty, 1);
                        splitter.SetValue(Grid.RowProperty, 0);
                        splitter.Width = 5;
                        secondGrid.Margin = new Thickness(5, 0, 0, 0);

                        grid.Children.Add(firstGrid);
                        grid.Children.Add(splitter);
                        grid.Children.Add(secondGrid);

                        InternalArrange(firstGrid, group.First);
                        InternalArrange(secondGrid, group.Second);
                    }
                }
            }
        }
开发者ID:truonghinh,项目名称:TnX,代码行数:86,代码来源:DockingGrid.cs

示例2: SplitViewHorizontally

        internal void SplitViewHorizontally(ITextView textView)
        {
            m_dockPanel.Children.Clear();
            _textViewHostList.Add(CreateTextViewHost());

            var grid = BuildGrid();
            var row = 0;
            for (int i = 0; i < _textViewHostList.Count; i++)
            {
                var textViewHost = _textViewHostList[i];
                var control = textViewHost.HostControl;
                control.SetValue(Grid.RowProperty, row++);
                control.SetValue(Grid.ColumnProperty, 0);
                grid.Children.Add(control);

                if (i + 1 < _textViewHostList.Count)
                {
                    var splitter = new GridSplitter();
                    splitter.ResizeDirection = GridResizeDirection.Rows;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.VerticalAlignment = VerticalAlignment.Stretch;
                    splitter.ShowsPreview = true;
                    splitter.SetValue(Grid.RowProperty, row++);
                    splitter.SetValue(Grid.ColumnProperty, 0);
                    splitter.Height = 5;
                    splitter.Background = Brushes.Black;
                    grid.Children.Add(splitter);
                }
            }

            m_dockPanel.Children.Add(grid);
        }
开发者ID:GitSullied,项目名称:VsVim,代码行数:32,代码来源:MainWindow.xaml.cs

示例3: InitializeComponent

        private void InitializeComponent(Configuration cfg)
        {
            this.Width = 1024;
            this.Height = 768;

            Button btnNew = NewImageButton(ApplicationCommands.New, "New", "New(Ctrl-N)", "New_16x16.png");
            Button btnOpen = NewImageButton(ApplicationCommands.Open, "Open", "Open(Ctrl-O)", "Open_16x16.png");
            Button btnSave = NewImageButton(ApplicationCommands.Save, "Save", "Save(Ctrl-S)", "Save_16x16.png");
            Button btnExecute = NewImageButton(ExecuteCommand, "Execute", "Execute(F5)", "Next_16x16.png");

            DockPanel dockPanel = new DockPanel();
            this.Content = dockPanel;

            //Tool bar
            ToolBarTray tray = new ToolBarTray();
            tray.SetValue(DockPanel.DockProperty, Dock.Top);
            dockPanel.Children.Add(tray);

            ToolBar toolBar;
            tray.ToolBars.Add(toolBar = new ToolBar());
            toolBar.Items.Add(btnNew);
            toolBar.Items.Add(btnOpen);
            toolBar.Items.Add(btnSave);
            tray.ToolBars.Add(toolBar = new ToolBar());
            toolBar.Items.Add(btnExecute);

            //status bar
            StatusBar statusBar = new StatusBar { Height = 20 };
            statusBar.Items.Add(new StatusBarItem { Content = lblMessage, HorizontalAlignment = HorizontalAlignment.Left });
            statusBar.Items.Add(new StatusBarItem { Content = lblCursorPosition, HorizontalAlignment = HorizontalAlignment.Right });
            statusBar.Items.Add(new StatusBarItem { Content = lblRowCount, HorizontalAlignment = HorizontalAlignment.Right });
            statusBar.SetValue(DockPanel.DockProperty, Dock.Bottom);
            dockPanel.Children.Add(statusBar);

            #region editor and results
            Grid grid = new Grid();
            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(5) });
            grid.RowDefinitions.Add(new RowDefinition());

            dockPanel.Children.Add(grid);
            textBox.Foreground = cfg.GetSolidBrush("gui.sql.editor.Foreground", Colors.Black);
            textBox.Background = cfg.GetSolidBrush("gui.sql.editor.Background", Colors.White);

            //Paragraph space
            Style style = new Style { TargetType = typeof(Paragraph) };
            style.Setters.Add(new Setter { Property = Block.MarginProperty, Value = new Thickness(0) });
            textBox.Resources.Add(typeof(Paragraph), style);

            GridSplitter splitter = new GridSplitter { Height = 5, HorizontalAlignment = HorizontalAlignment.Stretch };
            tabControl.Foreground = cfg.GetSolidBrush("gui.sql.editor.Foreground", Colors.Black);
            tabControl.Background = cfg.GetSolidBrush("gui.sql.editor.Background", Colors.White);

            textBox.SetValue(Grid.RowProperty, 0);
            splitter.SetValue(Grid.RowProperty, 1);
            tabControl.SetValue(Grid.RowProperty, 2);
            grid.Children.Add(textBox);
            grid.Children.Add(splitter);
            grid.Children.Add(tabControl);

            #endregion

            CommandBinding binding;
            RoutedUICommand[] commands = new RoutedUICommand[]
               {
                  ApplicationCommands.New,
                  ApplicationCommands.Open,
                  ApplicationCommands.Save,
                  ExecuteCommand
               };

            foreach (var cmd in commands)
            {
                binding = new CommandBinding(cmd);
                binding.Executed += commandExecute;
                binding.CanExecute += commandCanExecute;
                this.CommandBindings.Add(binding);
            }
        }
开发者ID:fjiang2,项目名称:sqlcon,代码行数:79,代码来源:SqlEditor.cs

示例4: reportGenerator_ResultsChange

        void reportGenerator_ResultsChange(object sender, ReportGenerator.ResultsChangedEventArgs results)
        {
            //Updating Charts
            var plotData = results.CurrentResults;
            if (plotData != null && plotData.Tests.Count > 0)
            {
                //Preparing Grid
                System.Windows.Threading.DispatcherOperation
                    dispatcherOp = ChartsGrid.Dispatcher.BeginInvoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        new Action(
                            delegate()
                            {
                                if (plotData.Tests.Count != ChartsGrid.RowDefinitions.Count)
                                {
                                    //Removing charts
                                    ChartsGrid.Children.Clear();
                                    ChartsGrid.RowDefinitions.Clear();
                                    //Adding components
                                    var plot1 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                    plot1.Name = "chart0_0";
                                    plot1.SetValue(Grid.RowProperty, 0);
                                    plot1.SetValue(Grid.ColumnProperty, 0);
                                    plot1.BorderBrush = new SolidColorBrush(Colors.Black);
                                    plot1.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                    var split = new GridSplitter() { Width = 4 };
                                    var plot2 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                    plot2.Name = "chart0_1";
                                    plot2.SetValue(Grid.RowProperty, 0);
                                    plot2.SetValue(Grid.ColumnProperty, 1);
                                    plot2.BorderBrush = new SolidColorBrush(Colors.Black);
                                    plot2.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                    ChartsGrid.Children.Add(plot1);
                                    ChartsGrid.Children.Add(split);
                                    ChartsGrid.Children.Add(plot2);
                                    ChartsGrid.Height = 700;
                                    ChartsGrid.RowDefinitions.Add(new RowDefinition() { });
                                    if (plotData.Tests.Count > 1)
                                    {
                                        for (int i = 1; i < plotData.Tests.Count; i++)
                                        {
                                            var plot3 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                            plot3.Name = String.Format("chart{0}_0", i);
                                            plot3.SetValue(Grid.RowProperty, i);
                                            plot3.SetValue(Grid.ColumnProperty, 0);
                                            plot3.BorderBrush = new SolidColorBrush(Colors.Black);
                                            plot3.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                            var split1 = new GridSplitter() { Width = 4 };
                                            split1.SetValue(Grid.RowProperty, i);
                                            var plot4 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                            plot4.Name = String.Format("chart{0}_1", i);
                                            plot4.SetValue(Grid.RowProperty, i);
                                            plot4.SetValue(Grid.ColumnProperty, 1);
                                            plot4.BorderBrush = new SolidColorBrush(Colors.Black);
                                            plot4.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                            ChartsGrid.Children.Add(plot3);
                                            ChartsGrid.Children.Add(split1);
                                            ChartsGrid.Children.Add(plot4);
                                            ChartsGrid.RowDefinitions.Add(new RowDefinition() { });
                                        }
                                        ChartsGrid.Height = plotData.Tests.Count * 500 + plotData.Tests.Count * 4;
                                    }
                                    ChartsGrid.UpdateLayout();
                                }
                            }));
                //For all Tests in Tests Data
                for (int testIndex = 0; testIndex < plotData.Tests.Count; testIndex++)
                {
                    var test = plotData.Tests[testIndex];
                    //Creating Model for Time
                    var tmp = new PlotModel("Duration", "using OxyPlot and NPerf");
                    if (isLogarithmic)
                    {
                        tmp.Axes.Add(new LogarithmicAxis(AxisPosition.Right, "Logarithmic"));
                    }
                    tmp.Title = "Duration (" + test.Name + ")";
                    int typeIndex = 0;
                    int testIndexInner = testIndex;

                    var runTotal = test.Runs[0];
                    var series =
                        (from PerfResult trun in runTotal.Results
                         select new LineSeries(trun.TestedType) { MarkerType = MarkerType.Circle }).Cast<Series>().ToList();

                    foreach (var run in test.Runs)
                    {
                        typeIndex = 0;
                        foreach (var trun in run.Results)
                        {
                            if (typeIndex < run.Results.Count)
                            {
                                //Series name: run.Results[index].testedtype
                                // Value -> run.Results[index]
                                (series[typeIndex] as LineSeries).Points.Add(new DataPoint(run.Value,
                                                                                           run.Results[typeIndex].
                                                                                               Duration));
                            }
                            typeIndex++;
                        }
                    }
//.........这里部分代码省略.........
开发者ID:sidlovskyy,项目名称:NPerf,代码行数:101,代码来源:MainWindow.xaml.cs

示例5: BuildGrid

        private Grid BuildGrid(ReadOnlyCollection<IVimViewInfo> viewInfoList)
        {
            Contract.Requires(viewInfoList.Count > 1);
            var grid = BuildGridCore(viewInfoList);
            var row = 0;
            for (int i = 0; i < viewInfoList.Count; i++)
            {
                var viewInfo = viewInfoList[i];
                var textViewHost = viewInfo.TextViewHost;
                var control = textViewHost.HostControl;
                control.SetValue(Grid.RowProperty, row++);
                control.SetValue(Grid.ColumnProperty, 0);
                grid.Children.Add(control);

                if (i + 1 < viewInfoList.Count)
                {
                    var splitter = new GridSplitter();
                    splitter.ResizeDirection = GridResizeDirection.Rows;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.VerticalAlignment = VerticalAlignment.Stretch;
                    splitter.ShowsPreview = true;
                    splitter.SetValue(Grid.RowProperty, row++);
                    splitter.SetValue(Grid.ColumnProperty, 0);
                    splitter.Height = 5;
                    splitter.Background = Brushes.Black;
                    grid.Children.Add(splitter);
                }
            }

            return grid;
        }
开发者ID:Kazark,项目名称:VsVim,代码行数:31,代码来源:MainWindow.xaml.cs

示例6: Redraw

        private void Redraw()
        {
            var properties = TypeDescriptor.GetProperties(viewModel.CollectionElementType).OfType<PropertyDescriptor>().Where(x => x.Attributes.OfType<ConfigurationPropertyAttribute>().Any()).ToArray();

            for (int n = 0; n <= viewModel.ChildElements.Count() + 1; n++)
            {
                Collection.RowDefinitions.Add(new RowDefinition());
            }

            int i = 0;
            foreach (var property in properties)
            {
                var label = new Label() { Content = property.DisplayName };
                Collection.Children.Add(label);
                label.SetValue(Grid.RowProperty, 0);
                label.SetValue(Grid.ColumnProperty, i);


                var gridSplitter = new GridSplitter() { Width = 2, HorizontalAlignment = HorizontalAlignment.Right };
                Collection.Children.Add(gridSplitter);
                gridSplitter.Focusable = false;
                gridSplitter.SetValue(Grid.RowProperty, 0);
                gridSplitter.SetValue(Grid.ColumnProperty, i);
                gridSplitter.SetValue(Grid.RowSpanProperty, viewModel.ChildElements.Count() + 1);
                i++;
            }

            ContextMenuButton addButton = new ContextMenuButton();
            Collection.Children.Add(addButton);
            CommandModel addCommand = viewModel.AddCommands.First();
            addButton.Command = addCommand;
            addButton.SetValue(Grid.RowProperty, 0);
            addButton.SetValue(Grid.ColumnProperty, i);
            addButton.Style = FindResource("ContextAdderButtonMenuStyle") as Style;
            addButton.VerticalAlignment = VerticalAlignment.Center;
            addButton.SetValue(AutomationProperties.AutomationIdProperty, addCommand.Title);
            
            int j = 1;
            foreach (var element in viewModel.ChildElements)
            {
                i = 0;
                foreach (var propertyDescriptor in properties)
                {
                    var property = element.Property(propertyDescriptor.Name);

                    ContentControl contentControl = new ContentControl();
                    contentControl.Focusable = false;
                    Collection.Children.Add(contentControl);
                    contentControl.SetValue(ContentControl.ContentProperty, property.BindableProperty);
                    contentControl.SetValue(Grid.RowProperty, j);
                    contentControl.SetValue(Grid.ColumnProperty, i);

                    i++;
                }

                Button deleteButton = new Button();
                Collection.Children.Add(deleteButton);
                CommandModel deleteCommand = element.Commands.Where(x => x.Placement == CommandPlacement.ContextDelete).First();
                deleteButton.Command = deleteCommand;
                deleteButton.SetValue(Grid.RowProperty, j);
                deleteButton.SetValue(Grid.ColumnProperty, i);
                deleteButton.Style = FindResource("DeleteButtonStyle") as Style;
                deleteButton.VerticalAlignment = VerticalAlignment.Center;
                deleteButton.SetValue(AutomationProperties.AutomationIdProperty, deleteCommand.Title);

                j++;
            }
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:68,代码来源:ElementCollectionEditor.xaml.cs

示例7: PopulateIEntityAttributes

        private bool PopulateIEntityAttributes(object obj)
        {
            EntityViewModel entity = obj as EntityViewModel;

             if (entity == null)
            return false;

             int rc = 0;
             foreach ( var attr in entity.Entity.Attributes )
             {
            RowDefinition rd = new RowDefinition();
            Properties.RowDefinitions.Add(rd);
            rd.MaxHeight = 20;
            ++rc;

            Border borderPname = new Border();
            borderPname.BorderBrush = Brushes.Black;
            borderPname.BorderThickness = new Thickness(0.5);

            // Add Property Name
            TextBlock tb = new TextBlock();
            tb.Margin = new Thickness(2);
            tb.Text = attr.Key;
            tb.TextAlignment = TextAlignment.Left;
            tb.VerticalAlignment = VerticalAlignment.Center;
            borderPname.Child = tb;
            Properties.Children.Add(borderPname);

            borderPname.SetValue(Grid.RowProperty, rc);
            borderPname.SetValue(Grid.ColumnProperty, 0);

            // Add Value
            TextBox edit = new TextBox();
            Binding valueBinding = new Binding();

            valueBinding.Path = new PropertyPath("Value");
            valueBinding.Source = new ValueWrapper(attr.Key, entity.Entity);
            edit.SetBinding(TextBox.TextProperty, valueBinding);

            Properties.Children.Add(edit);

            edit.SetValue(Grid.RowProperty, rc);
            edit.SetValue(Grid.ColumnProperty, 2);
             }

             GridSplitter gs = new GridSplitter();
             gs.ResizeDirection = GridResizeDirection.Columns;
             gs.ShowsPreview = true;
             gs.SnapsToDevicePixels = true;
             Properties.Children.Add(gs);
             gs.SetValue(Grid.ColumnProperty, 1);

             return true;
        }
开发者ID:VivekRagunathan,项目名称:EI,代码行数:54,代码来源:PropertyGrid.xaml.cs

示例8: SplitViewHorizontally

        internal void SplitViewHorizontally(IWpfTextView textView)
        {
            var tabInfo = ActiveTabInfo;
            var newTextViewHost = CreateTextViewHost(textView);
            var vimBuffer = _vimComponentHost.Vim.GetOrCreateVimBuffer(textView);
            tabInfo.AddViewInfo(vimBuffer, newTextViewHost);

            var viewInfoList = tabInfo.ViewInfoList.ToList();
            var grid = BuildGrid(viewInfoList);
            var row = 0;
            for (int i = 0; i < viewInfoList.Count; i++)
            {
                var viewInfo = viewInfoList[i];
                var textViewHost = viewInfo.TextViewHost;
                var control = textViewHost.HostControl;
                control.SetValue(Grid.RowProperty, row++);
                control.SetValue(Grid.ColumnProperty, 0);
                grid.Children.Add(control);

                if (i + 1 < viewInfoList.Count)
                {
                    var splitter = new GridSplitter();
                    splitter.ResizeDirection = GridResizeDirection.Rows;
                    splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                    splitter.VerticalAlignment = VerticalAlignment.Stretch;
                    splitter.ShowsPreview = true;
                    splitter.SetValue(Grid.RowProperty, row++);
                    splitter.SetValue(Grid.ColumnProperty, 0);
                    splitter.Height = 5;
                    splitter.Background = Brushes.Black;
                    grid.Children.Add(splitter);
                }
            }

            tabInfo.TabItem.Content = grid;
        }
开发者ID:jaredswarts55,项目名称:VsVim,代码行数:36,代码来源:MainWindow.xaml.cs

示例9: ReloadPluginsComplete

        private void ReloadPluginsComplete()
        {
            int count = _context.Plugins.Count;
            // create Grid.RowDefinitions
            for (var i = 0; i < count; i++)
            {
                ContentGrid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)});
                if (i != count - 1)
                {
                    ContentGrid.RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
                }
            }

            // Create GridSplitters
            for (var s = 0; s < count - 1; s++)
            {
                var spl = new GridSplitter
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Height = 5,
                    Tag = s
                };
                spl.SetValue(Grid.RowProperty, s*2 + 1);
                ContentGrid.Children.Add(spl);
            }
            // Create and start Plugins
            for (var c = 0; c < count; c++)
            {
                var plugin = _context.Plugins[c];
                var child = plugin.PluginControl;
                child.Margin = new Thickness(5);
                child.SetValue(Grid.RowProperty, c*2);
                ContentGrid.Children.Add(child);
                (new Task(() => StartAndRefreshPlugin(plugin))).Start();
            }
        }
开发者ID:Zagrebelin,项目名称:SideBar,代码行数:36,代码来源:MainWindow.xaml.cs

示例10: AddPanelToDisplay

        /// <summary>
        /// Add a panel to the display grid.
        /// </summary>
        private void AddPanelToDisplay(object sender, RoutedEventArgs args)
        {
            GridSplitter gridSplitter;
            IRegisteredPanel nextPanel = (IRegisteredPanel)sender;
            
            // Add the next panel
            ((UserControl)nextPanel).SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count);
            ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            ContentAreaGrid.Children.Add((UserControl)nextPanel);

            // Add a GridSplitter
            gridSplitter = new GridSplitter() { Height = 4.0d, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 3, 0, 3), Background = new SolidColorBrush(Colors.Transparent) };
            gridSplitter.SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count);
            gridSplitter.SetValue(Grid.ColumnProperty, 0);
            ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            ContentAreaGrid.Children.Add(gridSplitter);
        }
开发者ID:miaozhendaoren,项目名称:obd-express,代码行数:20,代码来源:MainWindow.xaml.cs

示例11: UpdatePanelsFromCollection

        /// <summary>
        /// Re-render the panels displayed from the selected panel collection.
        /// </summary>
        private void UpdatePanelsFromCollection(IPanelCollection panelCollection)
        {
            GridSplitter gridSplitter;
            System.Windows.Controls.MenuItem menuItem;

            // Prepare the Panels for Removal
            if (_selectedPanelCollection != null)
            {
                foreach (IRegisteredPanel nextPanel in _selectedPanelCollection.Panels)
                {
                    // Notify them to Pause Monitoring
                    nextPanel.PauseMonitoring();

                    // Unregister this MainWindow's event handlers from the Panel's events
                    nextPanel.UnRegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_HIDE_PANEL, RemovePanelFromDisplay);
                    nextPanel.UnRegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_SHOW_PANEL, AddPanelToDisplay);
                }
            }

            // Change Collections
            _selectedPanelCollection = panelCollection;

            // Clear out the Content Area
            ContentAreaGrid.Children.Clear();
            ContentAreaGrid.RowDefinitions.Clear();

            // Remove all menu items
            menAvailablePanels.Items.Clear();

            // Build the Row Definitions for the Home Panels and Add the panels
            foreach (IRegisteredPanel nextPanel in _selectedPanelCollection.Panels)
            {
                // Add the panel to available panels menu
                menuItem = new System.Windows.Controls.MenuItem();
                menuItem.Header = new Label() { Content = nextPanel.Title, Padding = new Thickness(0.0d) };
                menuItem.IsCheckable = true;
                menuItem.IsChecked = nextPanel.IsShown;

                // Register the panel's event handlers to the MenuItem's events
                menuItem.Checked += nextPanel.ShowPanel;
                menuItem.Unchecked += nextPanel.HidePanel;

                // Register this MainWindow's event handlers to the Panel's events
                nextPanel.RegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_HIDE_PANEL, RemovePanelFromDisplay);
                nextPanel.RegisterEventHandler(Variables.REGISTERED_EVENT_TYPE_SHOW_PANEL, AddPanelToDisplay);

                menAvailablePanels.Items.Add(menuItem);

                // Add the Panel to be displayed
                if (nextPanel.IsShown)
                {
                    // Add the next panel
                    ((UserControl)nextPanel).SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count);
                    ((UserControl)nextPanel).SetValue(Grid.ColumnProperty, 0);
                    ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
                    ContentAreaGrid.Children.Add((UserControl)nextPanel);

                    // Unpause the next panel
                    if (nextPanel.IsPaused)
                    {
                        nextPanel.UnPauseMonitoring();
                    }
                    else
                    {
                        nextPanel.StartMonitoring(ELM327Connection.Connection);
                    }

                    // Add a GridSplitter
                    gridSplitter = new GridSplitter() { Height = 4.0d, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 3, 0, 3), Background = new SolidColorBrush(Colors.Transparent) };
                    gridSplitter.SetValue(Grid.RowProperty, ContentAreaGrid.RowDefinitions.Count);
                    gridSplitter.SetValue(Grid.ColumnProperty, 0);
                    ContentAreaGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
                    ContentAreaGrid.Children.Add(gridSplitter);
                }
            }
        }
开发者ID:miaozhendaoren,项目名称:obd-express,代码行数:79,代码来源:MainWindow.xaml.cs

示例12: GetDefaultResizer

 /// <summary>
 /// Creates a GridSplitter as the default resizer for the grid.
 /// </summary>
 /// <returns>Grid splitter.</returns>
 private GridSplitter GetDefaultResizer()
 {
     GridSplitter resizerSplitter = new GridSplitter();
     resizerSplitter.SetValue(Canvas.ZIndexProperty, 5);
     resizerSplitter.Height = 20;
     resizerSplitter.HorizontalAlignment = HorizontalAlignment.Right;
     resizerSplitter.Width = 2;
     resizerSplitter.Background = new SolidColorBrush(Colors.Gray);
     resizerSplitter.Margin = new Thickness(2, 0, 2, 0);
     resizerSplitter.IsTabStop = false;
     resizerSplitter.MouseLeftButtonUp += new MouseButtonEventHandler(this.ResizerSplitter_MouseLeftButtonUp);
     return resizerSplitter;
 }
开发者ID:rbirkby,项目名称:mscui,代码行数:17,代码来源:WrapDataGrid.xaml.cs

示例13: CreateGridSplitter

		static GridSplitter CreateGridSplitter(int column)
		{
			GridSplitter splitter = new GridSplitter() { Width = 5, HorizontalAlignment = HorizontalAlignment.Left };
			splitter.SetValue(Grid.ColumnProperty, column);
			return splitter;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:6,代码来源:SourceClassFormEditor.xaml.cs

示例14: AddColumn

        internal void AddColumn(ExcelColumn column)
        {
            int currentIndex = NoOfColumns;

            // Add the column definitions for the header and the data grid
            ColumnDefinition colDefHeader = new ColumnDefinition();
            ColumnDefinition colDefMain = new ColumnDefinition();

            colDefHeader.Width = new GridLength(column.Width);
            colDefMain.Width = new GridLength(column.Width);

            grdHeaderGrid.ColumnDefinitions.Add(colDefHeader);
            grdMain.ColumnDefinitions.Add(colDefMain);

            // Bind the grid columns width to the header column widths
            // Only works in SL4 so need to use mousemove on the splitter instead
            //Binding bdnWidth = new Binding();
            //bdnWidth.Source = colDefHeader;
            //bdnWidth.Path = new PropertyPath("Width");
            //BindingOperations.SetBinding(colDefMain, ColumnDefinition.WidthProperty, bdnWidth);
        
            // Create the header control and add it to the header
            CellHeaderControl newHeader = new CellHeaderControl();

                Binding colorBinding = new Binding("HeaderColor");
                colorBinding.Source = this;
                newHeader.SetBinding(CellHeaderControl.BackgroundColorProperty, colorBinding);
           
            newHeader.Text = column.Header;
            newHeader.HeaderFontColor = HeaderFontColor;
            newHeader.HeaderFontFamily = HeaderFontFamily;
            newHeader.HeaderFontWeight = HeaderFontWeight;
            newHeader.HeaderFontSize = HeaderFontSize;
            newHeader.SetValue(Grid.RowProperty, 0);
            newHeader.SetValue(Grid.ColumnProperty, currentIndex);
            grdHeaderGrid.Children.Add(newHeader);

            column.Control = newHeader;
            newHeader.ExcelColumn = column;
            if (column.Width == 0)
            {
                colDefHeader.Width = new GridLength((int)newHeader.TextWidth + 40);
                ResizeMainColumn(currentIndex, colDefHeader.Width);
            }
            // Create th gridSplitter control and add it to the header.
            GridSplitter splitter = new GridSplitter();
            splitter.SetValue(Grid.RowProperty, 0);
            splitter.SetValue(Grid.ColumnProperty, currentIndex);
            splitter.Style = (Style)Resources["ColSplitter"];
            splitter.Background = HeaderBorderBrush;
            splitter.MouseMove += new MouseEventHandler(splitter_MouseMove);
            grdHeaderGrid.Children.Add(splitter);
        }
开发者ID:nilavghosh,项目名称:VChk,代码行数:53,代码来源:ExcelGridControl.xaml.cs


注:本文中的System.Windows.Controls.GridSplitter.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。