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

WPF form as Editor from PropertyGrid

3 Answers 131 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Dharmavaram
Top achievements
Rank 1
Dharmavaram asked on 19 Sep 2016, 09:15 AM

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.

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 20 Sep 2016, 09:50 AM
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.
0
Dharmavaram
Top achievements
Rank 1
answered on 20 Sep 2016, 11:00 AM

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.

 

 

0
Dilyan Traykov
Telerik team
answered on 20 Sep 2016, 01:38 PM
Hello Dharmavaram,

What you can do in this case is to handle the 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.
Tags
PropertyGrid
Asked by
Dharmavaram
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Dharmavaram
Top achievements
Rank 1
Share this question
or