New to Telerik UI for WPFStart a free 30-day trial

Binding PathGeometry of a RadPathButton to Glyph

Updated on Sep 15, 2025

Environment

ProductRadButtons for WPF

Description

How to bind the PathGeometry property of a RadPathButton to a glyph.

Solution

Create a custom IValueConverter that returns a geometry based on a glyph string and set it to the Converter property of the PathGeometry binding.

C#
	public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = this;
        }

        public string Glyph
        {
            get { return ""; }
        }
    }

    public class StringToGeometryConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return RadGlyph.GetGeometry(this.GetGlyph(value.ToString()), "TelerikWebUI");
        }
        private string GetGlyph(string hexCode)
        {
            string glyphInt = hexCode.Substring(3, 4);
            var character = (char)int.Parse(glyphInt, NumberStyles.HexNumber);
            return character.ToString();
        }
        
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }
    }
XAML
	<Grid>
        <Grid.Resources>
            <local:StringToGeometryConverter x:Key="StringToGeometryConverter" />
        </Grid.Resources>
        <telerik:RadPathButton  PathGeometry="{Binding Glyph, Converter={StaticResource StringToGeometryConverter}}" Width="75" Height="50" Content="Test" ContentPlacement="Right" />
    </Grid>

PathButton with PathGeometry bound to glyph

The "local" namespace refers to the namespace, where the StringToGeometryConverter is defined.

See Also