Wpf custom control template - relative font size

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 size for the "title" to be 5 Points LARGER than the size used in the content, which is inherited by whatever container the user places this control in.

How can I specify a font size in the control template for the header element using a relative value without exposing a property like "TitleFontSize" to the user? I want do "add 5".

I tried using a ScaleTransform on the header text block with mixed results (the text block scaled fine but the orientation was modified - I had the text right-justified and it moved "off the control" area when scaled). Also, I am not sure if scale transform would be approprite here.


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

<my:MathConverter x:Key="MathConverter" />


<TextBlock FontSize="{Binding
                     RelativeSource={RelativeSource AncestorType={x:Type Window}},
                     Converter={StaticResource MathConverter},
                     ConverterParameter=2}" />

Need Your Help

Debug Multiple ASP.Net Projects in VisualStudio2010

asp.net-mvc visual-studio-2010 model-view-controller visual-studio-debugging

I have a solution file with two applications loaded. Both are MVC enabled apps, one is a data API the other is a service that consumes the API. I dont have a server to house this application on yet...

facebook - List people who shared URL, using Graph API

facebook facebook-graph-api

Is it possible to get a list of users who shared a URL, using Graph API?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.