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();
                }
            }
        }
Exemple #2
0
        protected override void OnMouseEnter(MouseEventArgs e)
        {
            base.OnMouseLeave(e);

            if (e.OriginalSource == this && e.LeftButton == MouseButtonState.Pressed)
            {
                if (Type == MetroTileType.Small)
                {
                    Type = MetroTileType.Large;
                }
                else
                {
                    Type = MetroTileType.Small;
                }
            }
        }