示例#1
0
        private static void OnLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DragListBox dlb = (DragListBox)d;

            switch (e.NewValue)
            {
            case ELayout.RowMajor:
            case ELayout.SingleColumn:
                dlb.VerticalAlignment   = VerticalAlignment.Top;
                dlb.HorizontalAlignment = HorizontalAlignment.Stretch;
                dlb.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
                dlb.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
                break;

            case ELayout.ColumnMajor:
            case ELayout.SingleRow:
                dlb.VerticalAlignment   = VerticalAlignment.Stretch;
                dlb.HorizontalAlignment = HorizontalAlignment.Left;
                dlb.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
                dlb.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
                break;
            }
            if (dlb.dp != null)
            {
                dlb.dp.Layout = (ELayout)e.NewValue;
                dlb.dp.InvalidateMeasure();
            }
        }
示例#2
0
        private static void OnDropShadowColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DragListBox dlb = (DragListBox)d;

            if (dlb.dp != null)
            {
                dlb.dp.DropShadowColor = (Color)e.NewValue;
            }
        }