예제 #1
0
        private static void OnAdornmentLocationPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            AdornmentLogo     currentLogo = (AdornmentLogo)sender;
            AdornmentLocation newLocation = (AdornmentLocation)e.NewValue;

            switch (newLocation)
            {
            case AdornmentLocation.UseOffsets:
            case AdornmentLocation.UpperLeft:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Left;
                currentLogo.VerticalAlignment   = VerticalAlignment.Top;
                break;

            case AdornmentLocation.UpperCenter:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Center;
                currentLogo.VerticalAlignment   = VerticalAlignment.Top;
                break;

            case AdornmentLocation.UpperRight:
                currentLogo.VerticalAlignment   = VerticalAlignment.Top;
                currentLogo.HorizontalAlignment = HorizontalAlignment.Right;
                break;

            case AdornmentLocation.CenterLeft:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Left;
                currentLogo.VerticalAlignment   = VerticalAlignment.Center;
                break;

            case AdornmentLocation.Center:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Center;
                currentLogo.VerticalAlignment   = VerticalAlignment.Center;
                break;

            case AdornmentLocation.CenterRight:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Right;
                currentLogo.VerticalAlignment   = VerticalAlignment.Center;
                break;

            case AdornmentLocation.LowerLeft:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Left;
                currentLogo.VerticalAlignment   = VerticalAlignment.Bottom;
                break;

            case AdornmentLocation.LowerCenter:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Center;
                currentLogo.VerticalAlignment   = VerticalAlignment.Bottom;
                break;

            case AdornmentLocation.LowerRight:
            default:
                currentLogo.HorizontalAlignment = HorizontalAlignment.Right;
                currentLogo.VerticalAlignment   = VerticalAlignment.Bottom;
                break;
            }
        }
예제 #2
0
        private static void OnTopPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            AdornmentLogo currentLogo = (AdornmentLogo)sender;

            currentLogo.Margin = new Thickness(currentLogo.Left, (int)e.NewValue, -currentLogo.Left, -(int)e.NewValue);
        }