Esempio n. 1
0
        // Initialize our column object, passing the screen required, all others optional
        public MetroColumn(MetroScreen metroScreen, string titleText = "", string onClick = "", string navUrl = "")
        {
            // Look to see if there is a "last" column in the list, if not returns null
            MetroColumn lastColumnAdded = metroScreen.Columns.LastOrDefault();

            // Set the defaults for columns
            this.LeftMargin          = metroScreen.TilesStartLeftMargin;
            this.TilesTopMargin      = metroScreen.TilesStartTopMargin;
            this.SpacingBetweenTiles = metroScreen.SpacingBetweenTiles;
            this.NavUrl   = navUrl;
            this.Position = 0;

            // If this is not the first column, calculate the left margins based on the previous column
            if (lastColumnAdded != null)
            {
                lastColumnAdded.Width = lastColumnAdded.Rows.OrderBy(e => e.Width).LastOrDefault().Width;
                this.LeftMargin       = lastColumnAdded.LeftMargin + lastColumnAdded.Width + metroScreen.SpacingBetweenColumns;
                this.Position         = lastColumnAdded.Position + 1;
            }

            // Set the column title and click event
            this.TitleText = titleText;
            this.OnClick   = onClick;

            // Create our default list of rows for this column
            this.Rows = new List <MetroRow>();
        }
        // Add a column to the screen, both parameters are optional
        public MetroColumn AddColumn(string title = "", string onClick = "")
        {
            // Create the column
            MetroColumn newColumn = new MetroColumn(this, title, onClick);

            // Add the column to columns list
            this.Columns.Add(newColumn);

            // Return the column so it can be worked with
            return(newColumn);
        }
        // Add a column to the screen, both parameters are optional
        public MetroColumn AddColumn(string title = "", string onClick = "") 
        {
            // Create the column
            MetroColumn newColumn = new MetroColumn(this, title, onClick);

            // Add the column to columns list
            this.Columns.Add(newColumn);

            // Return the column so it can be worked with
            return newColumn;
        }
        // Initialize our object, the column object this row will belong is required
        public MetroRow(MetroColumn column)
        {
            this.Column = column;

            // Get the last row of our column to calculate the top of this row
            MetroRow lastRowAdded = this.Column.Rows.LastOrDefault();
            this.TopMargin = 0;

            // If there are no rows in this column yet, this is the first
            if (lastRowAdded == null)
            {
                this.TopMargin = column.TilesTopMargin;
            }
            else
            {
                // Calculate based on previous row
                this.TopMargin = lastRowAdded.TopMargin + lastRowAdded.Height + column.SpacingBetweenTiles;
            }

            // All rows need a list to hold their tiles
            this.Tiles = new List<MetroTile>();
        }
Esempio n. 5
0
        // Initialize our object, the column object this row will belong is required
        public MetroRow(MetroColumn column)
        {
            this.Column = column;

            // Get the last row of our column to calculate the top of this row
            MetroRow lastRowAdded = this.Column.Rows.LastOrDefault();

            this.TopMargin = 0;

            // If there are no rows in this column yet, this is the first
            if (lastRowAdded == null)
            {
                this.TopMargin = column.TilesTopMargin;
            }
            else
            {
                // Calculate based on previous row
                this.TopMargin = lastRowAdded.TopMargin + lastRowAdded.Height + column.SpacingBetweenTiles;
            }

            // All rows need a list to hold their tiles
            this.Tiles = new List <MetroTile>();
        }