Exemple #1
0
        private void SetWidth(MetroTileType type)
        {
            var width = Width;

            if (double.IsNaN(width))
            {
                width = ActualWidth;
            }
            if (width == 0)
            {
                return;
            }

            if (type == MetroTileType.Small)
            {
                if (WidthProperty.IsUnsetValue(this, BaseValueSource.DefaultStyle, BaseValueSource.Style))
                {
                    Width = width / 2 - Margin.Left / 2 - Margin.Right / 2;
                }
            }
            else
            {
                ClearValue(WidthProperty);
            }

            if (IsLoaded)
            {
                var page = this.GetVisualParent <MetroStartPage>();
                if (page != null)
                {
                    page.RefreshLayout();
                }
            }
        }