This is a migrated thread and some comments may be shown as answers.

Access Window of modal PropertyGrid.Editor

1 Answer 115 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
O
Top achievements
Rank 1
O asked on 03 Aug 2016, 05:59 PM

 

I'm looking at your demo for the PropertyGrid Editor Attribute. MapEditorControl.xaml is a UserControl which is set as an editor in Employee.cs using

        [Telerik.Windows.Controls.Data.PropertyGrid.Editor(typeof(MapEditorControl), "Location", Telerik.Windows.Controls.Data.PropertyGrid.EditorStyle.Modal),]
        public string Location
        {
            get
            {
                return this.location;
            }
            set
            {
                if (this.location != value)
                {
                    this.location = value;
                    this.OnPropertyChanged("Location");
                }
            }
        }

 

However, when you run the demo the UserControl MapEditorControl sits inside another Window (see attached image). How do I access this window to set header text, icons and themes?

Based on the demo it seems I can only access the UserControl and so any implicit themes will only work from here onward and not on it's parent window.

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 05 Aug 2016, 01:45 PM
Hello,

In order to achieve your goal, you can use the Loaded event of your UserControl and find its parent (the window). Please check the following code snippet for a reference:
UserControl x:Class="RadGridView_WPF_AR_88.UserControl1"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             Loaded="UserControl_Loaded"
         .
         .
         .
 using Telerik.Windows.Controls;
 public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
 
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            var window = this.ParentOfType<Window>();
            if (window != null)
            {
                window.Title = "Some Title";
            }
        }

I hope this helps.

Regards,
Yoan
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
PropertyGrid
Asked by
O
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or