private void SetupRowLayers(Grid parentGrid, Layer layer, int numberofRows)
        {
            var grid = new Grid
            {
                Name       = RowStr + LayerStr + layer.Level,
                Visibility = Visibility.Collapsed
            };

            grid.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition
            {
                SharedSizeGroup = RowStr + layer.Level,
                Height          = GridLength.Auto
            });
            //set up dock panel
            var dockpanel = new DockPanel
            {
                Margin        = new Thickness(0, 4, 0, 0),
                Background    = (RadialGradientBrush)PART_MasterGrid.FindResource("myColorfulLabelBrush"),
                LastChildFill = true
            };

            grid.Children.Add(dockpanel);
            Grid.SetRow(dockpanel, 1);
            var gridsplitter = new GridSplitter
            {
                Height              = 4,
                Background          = Brushes.CadetBlue,
                ResizeDirection     = GridResizeDirection.Rows,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Top
            };

            grid.Children.Add(gridsplitter);
            Grid.SetRow(gridsplitter, 1);
            //set up stackpanel
            var stackpanel = new StackPanel
            {
                Height = 25.0,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            dockpanel.Children.Add(stackpanel);
            DockPanel.SetDock(stackpanel, Dock.Top);
            //set up btn
            var btn = new Button
            {
                Name  = RowStr + PinStr + layer.Level,
                Width = 26.0,
                HorizontalAlignment = HorizontalAlignment.Right,
                Background          = Brushes.Transparent,
                BorderBrush         = Brushes.Transparent,
                Style           = (Style)PART_MasterGrid.FindResource("buttonStyle"),
                BorderThickness = new Thickness(0)
            };

            stackpanel.Children.Add(btn);
            var path = new Path
            {
                Stroke          = Brushes.Black,
                Fill            = Brushes.Gold,
                StrokeThickness = 1,
                Stretch         = Stretch.Fill,
                Width           = 9.0,
                Height          = 15
            };
            var pathgeometry = PinPathgeometry();

            path.Data   = pathgeometry;
            btn.Content = path;
            btn.Click  += (o, e) =>
            {
                int level = layer.Level;
                var pgrid = parentGrid;
                var item  = _rowLayers[level].Btn;
                if (item.Visibility == Visibility.Collapsed)
                {
                    RowUndockPane(level, o as Button, pgrid);
                }
                else
                {
                    RowDockPane(level, o as Button, pgrid);
                }
            };

            if (layer.Content != null)
            {
                dockpanel.Children.Add(layer.Content);
                DockPanel.SetDock(layer.Content, Dock.Top);
            }


            grid.MouseEnter += (o, e) =>
            {
                var level = layer.Level;
                for (var i = 1; i < _rowLayers.Count; i++)
                {
                    if (i == level)
                    {
                        continue;
                    }
                    if (_rowLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _rowLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }
            };
            PART_MasterGrid.Children.Add(grid);
            Grid.SetRow(grid, 0);
            var gnb = new GridnFloatingBtnCombo(grid, AddToRowStackPanel(layer));

            if (numberofRows > 0)
            {
                for (int i = layer.Level; i < numberofRows; i++)
                {
                    gnb.RowDefinitions.Add(new RowDefinition
                    {
                        SharedSizeGroup = RowStr + (i + 1),
                        Height          = GridLength.Auto
                    });
                }
            }
            _rowLayers.Add(gnb);
        }
        private Grid SetupLayer0(Layer layer0, IEnumerable <Layer> columnLayers, int numberofRows)
        {
            var grid = new Grid {
                Name = ColumnStr + LayerStr + layer0.Level
            };

            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            if (layer0.Content != null)
            {
                grid.Children.Add(layer0.Content);
            }
            if (layer0.Content != null)
            {
                Grid.SetColumn(layer0.Content, 1);
            }
            grid.MouseEnter += (o, e) =>
            {
                for (var i = 1; i < _columnLayers.Count; i++)
                {
                    if (_columnLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _columnLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }

                for (var i = 1; i < _rowLayers.Count; i++)
                {
                    if (_rowLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _rowLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }
            };
            //layer zero does not need a pin
            var gnb = new GridnFloatingBtnCombo(grid, null);

            if (columnLayers.Any())
            {
                var list = columnLayers.ToList();
                for (int i = 0; i < columnLayers.Count(); i++)
                {
                    gnb.ColumnDefinitions.Add(new ColumnDefinition {
                        SharedSizeGroup = ColumnStr + (i + 1) + list[i].ColumnLocation, Width = GridLength.Auto
                    });
                    gnb.ColumnLocations.Add(list[i].ColumnLocation);
                }
            }
            if (numberofRows > 0)
            {
                for (int i = 0; i < numberofRows; i++)
                {
                    gnb.RowDefinitions.Add(new RowDefinition {
                        SharedSizeGroup = RowStr + (i + 1), Height = GridLength.Auto
                    });
                }
            }
            _columnLayers.Add(gnb);
            _rowLayers.Add(gnb);
            return(grid);
        }
        private void SetupColumnLayers(Grid parentGrid, Layer layer, int columnLayerCnt)
        {
            var grid = new Grid
            {
                Name       = ColumnStr + LayerStr + layer.Level,
                Visibility = Visibility.Collapsed
            };

            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                SharedSizeGroup = layer.ColumnLocation == Layer.LayerColumnLocation.Left
                                                                            ? ColumnStr + layer.Level + layer.ColumnLocation
                                                                            : null,
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                SharedSizeGroup = layer.ColumnLocation == Layer.LayerColumnLocation.Right
                                                                            ? ColumnStr + layer.Level + layer.ColumnLocation
                                                                            : null,
                Width = GridLength.Auto
            });
            var internalGrid = new Grid();

            internalGrid.RowDefinitions.Add(new RowDefinition
            {
                Height = GridLength.Auto
            });
            internalGrid.RowDefinitions.Add(new RowDefinition());
            internalGrid.Background = (RadialGradientBrush)PART_MasterGrid.FindResource("myColorfulLabelBrush");
            grid.Children.Add(internalGrid);
            Grid.SetColumn(internalGrid,
                           layer.ColumnLocation == Layer.LayerColumnLocation.Left ? 0 : 2
                           );
            var dockpanel = new DockPanel();

            internalGrid.Children.Add(dockpanel);
            Grid.SetRow(dockpanel, 0);
            var btn = new Button
            {
                Name        = ColumnStr + PinStr + layer.Level,
                Width       = 28.0,
                Background  = Brushes.Transparent,
                BorderBrush = Brushes.Transparent,
                Style       = (Style)PART_MasterGrid.FindResource("buttonStyle"),
                Content     = new Path
                {
                    Stroke          = Brushes.Black,
                    Fill            = Brushes.Gold,
                    StrokeThickness = 1,
                    Stretch         = Stretch.Fill,
                    Width           = 9.0,
                    Height          = 15,
                    Data            = PinPathgeometry()
                }
            };

            dockpanel.Children.Add(btn);
            DockPanel.SetDock(btn, Dock.Right);
            btn.Click += (o, e) =>
            {
                var level = layer.Level;
                var item  = _columnLayers[level].Btn;
                if (item.Visibility == Visibility.Collapsed)
                {
                    ColumnUndockPane(level, o as Button);
                }
                else
                {
                    ColumnDockPane(level, o as Button);
                }
            };
            var textblock = new TextBlock
            {
                Padding      = new Thickness(8),
                TextTrimming = TextTrimming.CharacterEllipsis,
                Foreground   = Brushes.Gold,
                Text         = layer.Name
            };

            dockpanel.Children.Add(textblock);
            DockPanel.SetDock(textblock, Dock.Left);
            if (layer.Content != null)
            {
                internalGrid.Children.Add(layer.Content);
                Grid.SetRow(layer.Content, 1);
            }
            var gridSplitter = new GridSplitter
            {
                Width               = 2,
                Background          = Brushes.CadetBlue,
                HorizontalAlignment = layer.ColumnLocation == Layer.LayerColumnLocation.Right
                                                                            ? HorizontalAlignment.Left
                                                                            : HorizontalAlignment.Right
            };

            grid.Children.Add(gridSplitter);
            Grid.SetColumn(gridSplitter,
                           layer.ColumnLocation == Layer.LayerColumnLocation.Right ? 2 : 0
                           );
            grid.MouseEnter += (o, e) =>
            {
                var level = layer.Level;
                for (var i = (level + 1); i < _columnLayers.Count; i++)
                {
                    if (_columnLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _columnLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }
            };
            parentGrid.Children.Add(grid);
            Grid.SetRow(grid, 0);
            var gnb = new GridnFloatingBtnCombo(grid,
                                                AddToColumnStackPanel(layer)
                                                );

            if (columnLayerCnt > 0)
            {
                for (var i = layer.Level; i < columnLayerCnt; i++)
                {
                    gnb.ColumnDefinitions.Add(new ColumnDefinition
                    {
                        SharedSizeGroup = ColumnStr + (i + 1) + layer.ColumnLocation,
                        Width           = GridLength.Auto
                    });
                    gnb.ColumnLocations.Add(layer.ColumnLocation);
                }
            }
            _columnLayers.Add(gnb);
        }
Beispiel #4
0
        private Button AddToColumnStackPanel(Layer layer)
        {
            var btn = new Button
            {
                Background = Brushes.Transparent,
                BorderBrush = Brushes.Transparent,
                BorderThickness = new Thickness(0),
                Height = 32,
                MinWidth = 65.0,
                Width = 85,
                Padding = new Thickness(10, 0, 15, 0),
                FontWeight = FontWeights.Bold,
                FontSize  = 16,
                Style = (Style)PART_MasterGrid.FindResource("buttonStyle"),
                Content = layer.Name
            };
            btn.Click += (o, e) =>
            {
                var level = layer.Level;
                var item = _columnLayers[level];
                item.Grid.Visibility = Visibility.Visible;
                Grid.SetZIndex(item.Grid, 1);
                for (int i = 1; i < _columnLayers.Count; i++)
                {
                    if (i == level)
                        continue;
                    var loc = _columnLayers[i];
                    Grid.SetZIndex(loc.Grid, 0);
                    if (loc.Btn.Visibility == Visibility.Visible)
                        loc.Grid.Visibility = Visibility.Collapsed;

                }

            };
            if (layer.ColumnLocation == Layer.LayerColumnLocation.Right)
                PART_RightCntl.Children.Add(btn);
            else
                PART_LeftCntl.Children.Add(btn);
            return btn;
        }
Beispiel #5
0
        //Menu Button width
        private Button AddToRowStackPanel(Layer layer)
        {
            var btn = new Button
            {
                Background = Brushes.Transparent,
               // Background = Brushes.Wheat,
                BorderBrush = Brushes.Transparent,
                BorderThickness = new Thickness(0),
                Height = 34,
                Padding = new Thickness(10, 0, 15, 0),
                FontWeight = FontWeights.Bold,
                Style = (Style)PART_MasterGrid.FindResource("buttonStyle"),
                Content = layer.Name
            };
            btn.Click += (o, e) =>
            {
                var level = layer.Level;
                var item = _rowLayers[level];
                item.Grid.Visibility = Visibility.Visible;
                Grid.SetZIndex(item.Grid, 1);
                for (int i = 1; i < _rowLayers.Count; i++)
                {
                    if (i == level)
                        continue;
                    var loc = _rowLayers[i];
                    Grid.SetZIndex(loc.Grid, 0);
                    if (loc.Btn.Visibility == Visibility.Visible)
                        loc.Grid.Visibility = Visibility.Collapsed;

                }

            };
            PART_BottomCntl.Children.Add(btn);
            return btn;
        }
Beispiel #6
0
        private void SetupRowLayers(Grid parentGrid, Layer layer, int numberofRows)
        {
            var grid = new Grid
            {
                Name = RowStr + LayerStr + layer.Level,
                Visibility = Visibility.Collapsed
            };

            grid.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition
            {
                SharedSizeGroup = RowStr + layer.Level,
                Height = GridLength.Auto
            });
            //set up dock panel
            var dockpanel = new DockPanel
            {
                Margin = new Thickness(0, 4, 0, 0),
                Background = (RadialGradientBrush)PART_MasterGrid.FindResource("myColorfulLabelBrush"),
                LastChildFill = true
            };
            grid.Children.Add(dockpanel);
            Grid.SetRow(dockpanel, 1);
            var gridsplitter = new GridSplitter
            {
                Height = 4,
                Background = Brushes.CadetBlue,
                ResizeDirection = GridResizeDirection.Rows,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Top
            };
            grid.Children.Add(gridsplitter);
            Grid.SetRow(gridsplitter, 1);
            //set up stackpanel
            var stackpanel = new StackPanel
            {
                Height = 35.0,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };
            dockpanel.Children.Add(stackpanel);
            DockPanel.SetDock(stackpanel, Dock.Top);
            //set up btn
            var btn = new Button
            {
                Name = RowStr + PinStr + layer.Level,
                Width = 46.0,
                HorizontalAlignment = HorizontalAlignment.Right,
                Background = Brushes.Transparent,
                BorderBrush = Brushes.Transparent,
                Style = (Style)PART_MasterGrid.FindResource("buttonStyle"),
                BorderThickness = new Thickness(0)
            };
            stackpanel.Children.Add(btn);
            var path = new Path
            {
                Stroke = Brushes.Black,
                Fill = Brushes.Black,
                StrokeThickness = 1,
                Stretch = Stretch.Fill,
                Width = 19.0,
                Height = 25
            };
            var pathgeometry = PinPathgeometry();
            path.Data = pathgeometry;
            btn.Content = path;
            btn.Click += (o, e) =>
            {
                int level = layer.Level;
                var pgrid = parentGrid;
                var item = _rowLayers[level].Btn;
                if (item.Visibility == Visibility.Collapsed)
                    RowUndockPane(level, o as Button, pgrid);
                else
                    RowDockPane(level, o as Button, pgrid);
            };

            if (layer.Content != null)
            {
                dockpanel.Children.Add(layer.Content);
                DockPanel.SetDock(layer.Content, Dock.Top);
            }


            grid.MouseEnter += (o, e) =>
            {
                var level = layer.Level;
                for (var i = 1; i < _rowLayers.Count; i++)
                {
                    if (i == level)
                        continue;
                    if (_rowLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _rowLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }
            };
            PART_MasterGrid.Children.Add(grid);
            Grid.SetRow(grid, 0);
            var gnb = new GridnFloatingBtnCombo(grid, AddToRowStackPanel(layer));
            if (numberofRows > 0)
            {
                for (int i = layer.Level; i < numberofRows; i++)
                {
                    gnb.RowDefinitions.Add(new RowDefinition
                    {
                        SharedSizeGroup = RowStr + (i + 1),
                        Height = GridLength.Auto
                    });
                }
            }
            _rowLayers.Add(gnb);
        }
Beispiel #7
0
        private void SetupColumnLayers(Grid parentGrid, Layer layer, int columnLayerCnt)
        {
            var grid = new Grid
            {
                Name = ColumnStr + LayerStr + layer.Level,
                Visibility = Visibility.Collapsed
            };
            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                SharedSizeGroup = layer.ColumnLocation == Layer.LayerColumnLocation.Left
                                                                            ? ColumnStr + layer.Level + layer.ColumnLocation
                                                                            : null,
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(4, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                SharedSizeGroup = layer.ColumnLocation == Layer.LayerColumnLocation.Right
                                                                            ? ColumnStr + layer.Level + layer.ColumnLocation
                                                                            : null,
                Width = GridLength.Auto
            });
            var internalGrid = new Grid();
            internalGrid.RowDefinitions.Add(new RowDefinition
            {
                Height = GridLength.Auto
            });
            internalGrid.RowDefinitions.Add(new RowDefinition());
            internalGrid.Background = (RadialGradientBrush)PART_MasterGrid.FindResource("myColorfulLabelBrush");
            grid.Children.Add(internalGrid);
            Grid.SetColumn(internalGrid,
                           layer.ColumnLocation == Layer.LayerColumnLocation.Left ? 0 : 2
                          );
            var dockpanel = new DockPanel();
            internalGrid.Children.Add(dockpanel);
            Grid.SetRow(dockpanel, 0);
            //Pin Button
            var btn = new Button
            {
                Name = ColumnStr + PinStr + layer.Level,
                Width = 35.0,
               // Background = Brushes.Transparent,
                Background = Brushes.White,
                BorderBrush = Brushes.Black,
                Style = (Style)PART_MasterGrid.FindResource("buttonStyle"),
                Content = new Path
                {
                    Stroke = Brushes.Black,
                    Fill = Brushes.Black,
                    StrokeThickness = 1,
                    Stretch = Stretch.Fill,
                    Width = 25.0,
                    Height = 35,
                    Data = PinPathgeometry()
                }

            };
            dockpanel.Children.Add(btn);
            DockPanel.SetDock(btn, Dock.Right);
            btn.Click += (o, e) =>
            {
                var level = layer.Level;
                var item = _columnLayers[level].Btn;
                if (item.Visibility == Visibility.Collapsed)
                    ColumnUndockPane(level, o as Button);
                else
                    ColumnDockPane(level, o as Button);
            };
            var textblock = new TextBlock
            {
                Padding = new Thickness(8),
                TextTrimming = TextTrimming.CharacterEllipsis,
                Foreground = Brushes.Black,
                Text = layer.Name
            };
            dockpanel.Children.Add(textblock);
            DockPanel.SetDock(textblock, Dock.Left);
            if (layer.Content != null)
            {
                internalGrid.Children.Add(layer.Content);
                Grid.SetRow(layer.Content, 1);
            }
            var gridSplitter = new GridSplitter
            {
                Width = 2,
                Background = Brushes.CadetBlue,
                HorizontalAlignment = layer.ColumnLocation == Layer.LayerColumnLocation.Right
                                                                            ? HorizontalAlignment.Left
                                                                            : HorizontalAlignment.Right
            };
            grid.Children.Add(gridSplitter);
            Grid.SetColumn(gridSplitter,
                           layer.ColumnLocation == Layer.LayerColumnLocation.Right ? 2 : 0
                          );
            grid.MouseEnter += (o, e) =>
            {
                var level = layer.Level;
                for (var i = (level + 1); i < _columnLayers.Count; i++)
                {
                    if (_columnLayers[i].Btn.Visibility == Visibility.Visible)
                        _columnLayers[i].Grid.Visibility = Visibility.Collapsed;
                }
            };
            parentGrid.Children.Add(grid);
            Grid.SetRow(grid, 0);
            var gnb = new GridnFloatingBtnCombo(grid,
                                                 AddToColumnStackPanel(layer)
                                               );
            if (columnLayerCnt > 0)
            {
                for (var i = layer.Level; i < columnLayerCnt; i++)
                {
                    gnb.ColumnDefinitions.Add(new ColumnDefinition
                    {
                        SharedSizeGroup = ColumnStr + (i + 1) + layer.ColumnLocation,
                        Width = GridLength.Auto
                    });
                    gnb.ColumnLocations.Add(layer.ColumnLocation);
                }
            }
            _columnLayers.Add(gnb);

        }
Beispiel #8
0
        private Grid SetupLayer0(Layer layer0, IEnumerable<Layer> columnLayers, int numberofRows)
        {
            var grid = new Grid { Name = ColumnStr + LayerStr + layer0.Level };
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            if (layer0.Content != null)
                grid.Children.Add(layer0.Content);
            if (layer0.Content != null)
                Grid.SetColumn(layer0.Content, 1);
            grid.MouseEnter += (o, e) =>
            {
                for (var i = 1; i < _columnLayers.Count; i++)
                {
                    if (_columnLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _columnLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }

                for (var i = 1; i < _rowLayers.Count; i++)
                {
                    if (_rowLayers[i].Btn.Visibility == Visibility.Visible)
                    {
                        _rowLayers[i].Grid.Visibility = Visibility.Collapsed;
                    }
                }
            };
            //layer zero does not need a pin
            var gnb = new GridnFloatingBtnCombo(grid, null);
            if (columnLayers.Any())
            {
                var list = columnLayers.ToList();
                for (int i = 0; i < columnLayers.Count(); i++)
                {
                    gnb.ColumnDefinitions.Add(new ColumnDefinition { SharedSizeGroup = ColumnStr + (i + 1) + list[i].ColumnLocation, Width = GridLength.Auto });
                    gnb.ColumnLocations.Add(list[i].ColumnLocation);
                }
            }
            if (numberofRows > 0)
            {
                for (int i = 0; i < numberofRows; i++)
                {
                    gnb.RowDefinitions.Add(new RowDefinition { SharedSizeGroup = RowStr + (i + 1), Height = GridLength.Auto });
                }
            }
            _columnLayers.Add(gnb);
            _rowLayers.Add(gnb);
            return grid;
        }