コード例 #1
0
            private Thickness calculateThickness(GridPresenter host)
            {
                var grid = host.Grid;

                if (grid == null)
                {
                    return(new Thickness());
                }

                double baseThickness = host.GridBorderWidth;

                switch (grid.Index)
                {
                case 0:
                case 1:
                case 3:
                case 4:
                    return(new Thickness(baseThickness, baseThickness, 0, 0));

                case 2:
                case 5:
                    return(new Thickness(baseThickness, baseThickness, baseThickness, 0));

                case 6:
                case 7:
                    return(new Thickness(baseThickness, baseThickness, 0, baseThickness));

                case 8:
                    return(new Thickness(baseThickness));

                default:
                    return(new Thickness(0));
                }
            }
コード例 #2
0
            public BorderThicknessUpdator(GridPresenter host)
            {
                if (host == null)
                {
                    throw new ArgumentNullException("host");
                }
                this.host = host;

                DependencyPropertyDescriptor.FromProperty(
                    GridPresenter.GridBorderWidthProperty,
                    typeof(GridPresenter))
                .AddValueChanged(host, UpdateNeeded);
                DependencyPropertyDescriptor.FromProperty(
                    GridPresenter.GridProperty,
                    typeof(GridPresenter))
                .AddValueChanged(host, UpdateNeeded);
            }
コード例 #3
0
 private void updateElementBorderThickness(GridPresenter host)
 {
     host.SetGridBorderThickness(calculateThickness(host));
 }