WPF form as Editor from PropertyGrid

4 posts, 0 answers
  1. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 19 Sep Link to this post

    Hi,

       I have WPF Form which has to be invoked as editor from RadPropertyGrid and here another difficult thing is I have to send input to the constructor of this form.In winform using UITypeEditor inherited class we have created another editor and used it.But in RadPropertyGrid how to achieve this??

     

    Regards,

    Nagasree.

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    368 posts

    Posted 20 Sep Link to this post

    Hello Dharmavaram,

    I'm not sure I fully understood your requirements from your previous reply, but if I'm not mistaken, setting the EditorAttribute of the property to your WPF form should result in the desired behavior.

    Could you please give this a try and let me know if it works for you? If that is not the case, please provide more information on the exact result you're trying to achieve and I will happily assist you further.

    Regards,
    Dilyan Traykov
    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
  4. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 20 Sep in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

         I have used EditorAttribute only but when I tried to invoke WPF form having Editor Style as Modal it threw exception.

    Just try to invoke a simple WPF form as modal dialog instead of usercontrol,we will get issue.

    Please try and let me know if you need further details.

    Regards,

    Nagasree.

     

     

  5. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    368 posts

    Posted 20 Sep Link to this post

    Hello Dharmavaram,

    What you can do in this case is to handle the edit process manually, by handling RadPropertyGrid's BeginningEdit event, like so:

    private void radPropertyGrid_BeginningEdit(object sender, Telerik.Windows.Controls.Data.PropertyGrid.PropertyGridBeginningEditEventArgs e)
    {
        var pd = e.Field.DataContext as PropertyDefinition;
        var property = pd.SourceProperty;
        if (property.PropertyType == typeof(PhoneNumber))
        {
            e.Cancel = true;
            var window = new RadWindow();
            window.DataContext = pd.Value;
            window.HideMaximizeButton = true;
            window.HideMinimizeButton = true;
            window.Header = "Phone Number";
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.Content = new PhoneEditorControl();
      
            window.Show();
        }
    }

    Of course, you should tailor this to fit your exact requirements. I hope you find this example helpful.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top