WPF › Control Visual Sizer › ResizerGripElementAlignmentConverter
ResizerGripElementAlignmentConverter
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Containers
Turns a Direction into the alignment that places the resize grip in the right corner
of a ControlVisualResizer.
public sealed class ResizerGripElementAlignmentConverter : IValueConverter
Inherits from / implements: IValueConverter
Remarks
The default template binds the grip's
FrameworkElement.HorizontalAlignment and FrameworkElement.VerticalAlignment
through it, with the converter parameter saying which of the two is wanted. It is public so that a
template of your own can do the same.
Examples
<ResizeGrip x:Name="PART_ReSizerGrip"
HorizontalAlignment="{TemplateBinding Direction, Converter={StaticResource GripAlignment},
ConverterParameter={x:Static Orientation.Horizontal}}"
VerticalAlignment="{TemplateBinding Direction, Converter={StaticResource GripAlignment},
ConverterParameter={x:Static Orientation.Vertical}}" />Members at a glance
| Methods | |
|---|---|
Convert | Returns the grip's alignment on the axis named by parameter. |
ConvertBack | Not supported: an alignment cannot be turned back into a direction. |
Methods
Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Returns the grip's alignment on the axis named by parameter.
Parameters
value- The resizer's
Direction. targetType- Not used.
parameter- An
Orientation:Horizontalfor aHorizontalAlignment,Verticalfor aVerticalAlignment. culture- Not used.
Returns
Horizontally, HorizontalAlignment.Right for
Direction.SouthEast and HorizontalAlignment.Left for any other
direction; vertically, always VerticalAlignment.Bottom.
Exceptions
System.InvalidCastExceptionparameteris not anOrientation, orvalueis not aDirection.System.NullReferenceExceptionparameterorvalueisnull.
ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Not supported: an alignment cannot be turned back into a direction.
Parameters
value- Not used.
targetType- Not used.
parameter- Not used.
culture- Not used.
Returns
Always DependencyProperty.UnsetValue.