Skip to content

A WPF friendly port of the tango icon theme. Scalable SVG icons have been converted into XAML. Icons are embedded as the optimized BAML format, resulting in faster loading and a much smaller file size (about 1/2 of raw XAML, and 1/3 of raw SVG). The "LazyConverter" class does lazy intialization and provides conversions useful in various scenarios.

TheFirstDeity/TangoXaml

 
 

Repository files navigation

TangoXaml Example

TangoXaml

###Download with NuGet: http://www.nuget.org/packages/TangoXaml


##Summary A WPF friendly port of the tango icon theme. Scalable SVG icons have been converted into XAML. Icons are embedded as the optimized BAML format, resulting in faster loading and a much smaller file size (about 1/2 of raw XAML, and 1/3 of raw SVG). The "LazyConverter" class does lazy intialization and provides conversions useful in various scenarios.

##Example

####MainSkin.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:tango="clr-namespace:TangoXaml;assembly=TangoXaml">
    
    <ResourceDictionary.MergedDictionaries>
        <tango:Actions />
        <tango:Devices />
        <tango:Emblems />
    </ResourceDictionary.MergedDictionaries>

    <!-- "Converter" which JIT compiles the Tango icon graphics -->
    <tango:LazyConverter x:Key="LazyConverter" />
    
    <!-- Assign icon keys for this skin -->
    <DrawingImage x:Key="SaveIcon" 
                  Drawing="{Binding 
        Source={StaticResource ResourceKey=media-floppy},
        Converter={StaticResource LazyConverter}}" />

    <DrawingImage x:Key="OpenIcon" 
                  Drawing="{Binding 
        Source={StaticResource ResourceKey=document-open},
        Converter={StaticResource LazyConverter}}" />

    <DrawingImage x:Key="FormatBoldIcon" 
                  Drawing="{Binding 
        Source={StaticResource ResourceKey=format-text-bold},
        Converter={StaticResource LazyConverter}}" />

    <DrawingImage x:Key="FormatItalicIcon" 
                  Drawing="{Binding 
        Source={StaticResource ResourceKey=format-text-italic},
        Converter={StaticResource LazyConverter}}" />

    <DrawingImage x:Key="FormatUnderlineIcon" 
                  Drawing="{Binding 
        Source={StaticResource ResourceKey=format-text-underline},
        Converter={StaticResource LazyConverter}}" />

    <DrawingImage x:Key="SettingsIcon" 
                  Drawing="{Binding 
        Source={StaticResource ResourceKey=emblem-system},
        Converter={StaticResource LazyConverter}}" />

</ResourceDictionary>

####MainWindow.xaml

<Window x:Class="Example.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ignore="http://www.ignore.com"
        mc:Ignorable="d ignore"
        Height="480"
        Width="854"
        Title="TangoXaml Example">
    
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skin/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <Ribbon>
            <Ribbon.ApplicationMenu>
                <RibbonApplicationMenu SmallImageSource="{StaticResource SettingsIcon}">
                </RibbonApplicationMenu>
            </Ribbon.ApplicationMenu>
            
            <RibbonTab Header="Home" IsSelected="True">
                <RibbonGroup Header="File">
                    <RibbonButton Label="Open" LargeImageSource="{StaticResource OpenIcon}" />
                    <RibbonButton Label="Save" LargeImageSource="{StaticResource SaveIcon}" />
                </RibbonGroup>
                <RibbonGroup Header="Edit">
                    <RibbonButton Label="Bold" LargeImageSource="{StaticResource FormatBoldIcon}" />
                    <RibbonButton Label="Italic" LargeImageSource="{StaticResource FormatItalicIcon}" />
                    <RibbonButton Label="Underline" LargeImageSource="{StaticResource FormatUnderlineIcon}" />
                </RibbonGroup>
            </RibbonTab>

        </Ribbon>
    </Grid>
</Window>

####Result TangoXaml Example

####Icons stay smooth (non-pixelated) even with 800% zoom


Changes

1.0.3

  • Removed duplicate line of code
  • Closed all the streams I forgot about

1.0.2

  • Optimization: XAML files are pre-compiled into BAML instead of being JIT-compiled at runtime
  • Assembly size has been cut in half!

1.0.1

  • Correction to LazyConverter type checking

Credits

Fork Author: TheFirstDeity
Fork Copyright 2014: Monadone (me@monadone.com)
Project Page: https://github.com/TheFirstDeity/TangoXaml
Forked From: https://github.com/stephenc/tango-icon-theme


Liscense

The software portion of this repository is liscensed under the MS-PL. The liscense is located in the software's folder.

About

A WPF friendly port of the tango icon theme. Scalable SVG icons have been converted into XAML. Icons are embedded as the optimized BAML format, resulting in faster loading and a much smaller file size (about 1/2 of raw XAML, and 1/3 of raw SVG). The "LazyConverter" class does lazy intialization and provides conversions useful in various scenarios.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 94.6%
  • Shell 5.4%