LongTextToTextBlockConverter
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Office
Turns a caption into a centred two-line TextBlock, broken at the space nearest its
middle – how a large ribbon button sets its caption under its picture.
public class LongTextToTextBlockConverter : IValueConverter
Inherits from / implements: IValueConverter
Remarks
Used by the large toggle button and by the button a folded group becomes; it is public so that a template of your own can lay a caption out the same way.
Examples
<ContentPresenter Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent},
Converter={StaticResource longTextToTextBlockConverter}}" />Members at a glance
| Methods | |
|---|---|
Convert | Lays a caption out on two lines. |
ConvertBack | Not supported: the conversion is one-way. |
Methods
Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Lays a caption out on two lines.
Parameters
value- The caption.
targetType- Not used.
parameter- Not used.
culture- Not used.
Returns
A new TextBlock, centred and wrapping, with a 12-unit line height and the caption
broken at the space nearest its middle (left whole when it has no space). A value that is not a
string, or an empty string, is returned unchanged.
ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Not supported: the conversion is one-way.
Parameters
value- Not used.
targetType- Not used.
parameter- Not used.
culture- Not used.
Returns
Never returns.