Access Window of modal PropertyGrid.Editor

2 posts, 0 answers
  1. O
    O avatar
    1 posts
    Member since:
    Jan 2015

    Posted 03 Aug Link to this post

     

    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

  2. Yoan
    Admin
    Yoan avatar
    1068 posts

    Posted 05 Aug Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top