Change PG title from "Properties" to custom text (Expression Theme)

Mar 27, 2010 at 9:50 PM

If you would like to change PGs title during runtime ("Properties" did not match may needs  :-) ) you can change it by adding the following code:

PropertyGrid.cs:

        #region PropertyGrid Headline

        /// <summary>
        /// DependenyProperty for the headline of the Propertygrid.
        /// </summary>
        public static readonly DependencyProperty HeadlineProperty = DependencyProperty.Register("Headline", typeof(string), typeof(PropertyGrid), new FrameworkPropertyMetadata("Properties"));

        /// <summary>
        /// Gets or sets the Headline of the Propertygrid.
        /// </summary>
        public string Headline
        {
            get { return (string)GetValue(HeadlineProperty); }
            set { SetValue(HeadlineProperty, value); }
        }

        #endregion
PropertyGrid.xaml:
replace the following line
<TextBlock Text="Properties" Width="Auto" Height="Auto" Foreground="#FFFFFFFF" Margin="8" HorizontalAlignment="Left" VerticalAlignment="Center" />
with this on:
<TextBlock Text="{TemplateBinding local:PropertyGrid.Headline}" Width="Auto" Height="Auto" Foreground="#FFFFFFFF" Margin="8" HorizontalAlignment="Left" VerticalAlignment="Center" />
Coordinator
Mar 28, 2010 at 9:34 AM

Patch applied! Thanks.