Exemplo n.º 1
0
        private void UpdateMetadata()
        {
            var metadata = CreateMetadata();

            if (Metadata != null && Metadata == metadata)
            {
                return;
            }

            using (_updateMonitor.Enter())
                Metadata = metadata;
        }
Exemplo n.º 2
0
        public GridMetadata CreateMetadata()
        {
            var metadata = new GridMetadata();
            var grid     = AssociatedObject.Parent as Grid;

            if (grid == null)
            {
                return(metadata);
            }

            double totalWidth     = grid.ActualWidth;
            double totalHeight    = grid.ActualHeight;
            int    splitterColumn = Grid.GetColumn(AssociatedObject);
            int    splitterRow    = Grid.GetRow(AssociatedObject);

            for (int index = 0; index < grid.ColumnDefinitions.Count; index++)
            {
                var    definition = grid.ColumnDefinitions[index];
                double width      = definition.ActualWidth;
                if (splitterColumn != index)
                {
                    width = (width / totalWidth) * 100;
                }

                metadata.ColumnWidths.Add(width);
            }

            for (int index = 0; index < grid.RowDefinitions.Count; index++)
            {
                var    definition = grid.RowDefinitions[index];
                double height     = definition.ActualHeight;
                if (splitterRow != index)
                {
                    height = (height / totalHeight) * 100;
                }

                metadata.RowHeights.Add(height);
            }

            return(metadata);
        }