Title Link Icon

Jan 31, 2015 at 11:59 PM
I did a quick hack to add icons to the title links via a IconData property. My solution is a bit ugly, but I would love to get support for this in the real package :) plplplplplease? :D

screenshot of the title links with icons

This is how I did - Added an IconData property to Link.cs:
private Geometry iconData;
/// <summary>
/// Gets or sets the icondata
/// </summary>
/// <value>The source.</value>
public Geometry IconData
{
    get { return this.iconData; }
    set
    {
        if (this.iconData != value)
        {
            this.iconData = value;
            OnPropertyChanged("IconData");
        }
    }
}
Then modified the DataTemplate for the title links in ModernWindow.xaml, added the Canvas-part only:
<StackPanel Orientation="Horizontal">
    <Line x:Name="Separator"
            X1=".5"
            Y1="3"
            X2=".5"
            Y2="12"
            Margin="5,0"
            VerticalAlignment="Center"
            Stroke="{DynamicResource SeparatorBackground}" />
    <Canvas Width="20"
            Height="20"
            Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
        <Path Width="10"
                Height="10"
                Canvas.Left="5"
                Canvas.Top="5"
                Stretch="Fill"
                Fill="#FF000000"
                Data="{Binding IconData}" />
    </Canvas>
    <Button Content="{Binding DisplayName}"
            Command="navigation:LinkCommands.NavigateLink"
            CommandParameter="{Binding Source}"
            CommandTarget="{Binding ElementName=ContentFrame}"
            Style="{StaticResource SystemButtonLink}" />

</StackPanel>
That's it. The icon is not clickable and should be part of the Button, which requires changing the styles etc... more work than I wanted to do. To use it, I added some icons like this:
<mui:ModernWindow.TitleLinks>
    <mui:Link DisplayName="Settings"
                Source="/Pages/Settings.xaml"
                IconData="F1 M 38,23.5C 38.8643,23.5 39.7109,23.5756 40.5337,23.7206L 42.6275,18.5381L 48.1901,20.787L 46.0964,25.9692C 47.6473,27.0149 48.9851,28.3527 50.0308,29.9036L 55.213,27.8099L 57.4619,33.3725L 52.2794,35.4664C 52.4244,36.2891 52.5,37.1357 52.5,38C 52.5,38.8643 52.4244,39.7109 52.2794,40.5337L 57.4619,42.6275L 55.213,48.1901L 50.0308,46.0964C 49.0795,47.5073 47.8865,48.7418 46.5112,49.7405L 48.7844,54.8462L 43.3041,57.2891L 41.0307,52.1828C 40.0533,52.3906 39.0394,52.5 38,52.5C 37.1357,52.5 36.2891,52.4244 35.4664,52.2794L 33.3725,57.462L 27.8099,55.213L 29.9036,50.0309C 28.3527,48.9851 27.0149,47.6473 25.9691,46.0964L 20.787,48.1901L 18.538,42.6275L 23.7206,40.5336C 23.5756,39.7109 23.5,38.8643 23.5,38C 23.5,37.1357 23.5756,36.2891 23.7206,35.4664L 18.538,33.3725L 20.787,27.8099L 25.9691,29.9036C 26.9205,28.4927 28.1135,27.2582 29.4889,26.2594L 27.2157,21.1537L 32.6959,18.7109L 34.9694,23.8172C 35.9468,23.6094 36.9606,23.5 38,23.5 Z M 38,28C 32.4771,28 28,32.4772 28,38C 28,43.5229 32.4771,48 38,48C 43.5228,48 48,43.5229 48,38C 48,32.4772 43.5228,28 38,28 Z " />
    <mui:Link DisplayName="Help"
                Source="http://mui.codeplex.com"
                IconData="F1 M 25,27L 46,19L 46,22.25L 28.5,29L 31.75,31.25L 51,23.75L 51,48.5L 31.75,57L 25,52L 25,27 Z M 41.8929,46.0327C 40.9009,46.4197 40.0967,47.5376 40.0967,48.5296C 40.0967,49.5216 40.9009,50.0121 41.8929,49.6251C 42.8849,49.2381 43.6891,48.1202 43.6891,47.1282C 43.6891,46.1361 42.8849,45.6457 41.8929,46.0327 Z M 42.2521,31.5228C 39.0777,32.7612 36.5042,36.1777 36.5042,39.1538L 36.5042,39.8723L 40.0967,38.4708L 40.0967,37.3931C 40.0967,36.2027 41.0617,34.8612 42.2521,34.3968C 43.4425,33.9324 44.4076,34.5209 44.4076,35.7113C 44.4076,36.2305 44.4076,36.4298 42.9706,38.4274C 42.2521,39.4262 40.0967,41.7753 40.0967,44.2187L 40.0967,45.2964L 43.6891,43.895L 43.6891,42.458C 43.6891,41.2676 44.4076,40.0223 45.8445,38.7432C 47.2815,37.4641 48,35.3876 48,34.3099C 48,31.3338 45.4266,30.2844 42.2521,31.5228 Z " />
</mui:ModernWindow.TitleLinks>