Wpf custom control template - relative font size

前端 未结 2 1450
情书的邮戳
情书的邮戳 2020-12-18 03:37

I am creating a custom WPF control that let\'s say for simplicity sake has a vertical stack panel with a \"title\" TextBlock, followed by a ContentPresenter. I want the font

2条回答
  •  佛祖请我去吃肉
    2020-12-18 04:26

    A more generic way

    Value converter

    public class MathConverter : IValueConverter
    {
        public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
        {
            return (double)value + double.Parse( parameter.ToString() );
        }
    
        public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
        {
            return null;
        }
    }
    

    Converter Resource

    
    

    XAML

    
    

提交回复
热议问题