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

PropertyGrid problems in 2013 Q2

5 Answers 89 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Dodd
Top achievements
Rank 1
Dodd asked on 31 Jul 2013, 05:55 AM
Hello, I have two issues on PropertyGrid in WPF 2013.2.611.40.
First, I tested several kinds of type converters but only the basic type converter seems to work.
Converters in the code below don't work except for ConvertTo.


    private string _name;
    [TypeConverter(typeof(Tuple3iConverter))]
    public string Name
    {
        get { return _name; }
        set { _name = value; }
    }

    public class Tuple3iConverter : TypeConverter
    {
        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        {
            if (context == null)
            {
                return false;
            }
            return ((sourceType == typeof(string)) || base.CanConvertFrom(context, sourceType));
        }
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                return value;
            }
            return base.ConvertFrom(context, culture, value);
        }

        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (value.Equals("New"))
                    return "lsw822Man";
                else
                    return "NewMan";
            }
            return base.ConvertTo(context, culture, value, destinationType);
        }

        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            List<string> genericList = new List<string>();

            genericList.Add("lsw822");
            genericList.Add("lsw833");
            genericList.Add("lsw844");

            return new TypeConverter.StandardValuesCollection(genericList);
        }

        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }
    }

+

Second, when I resize the label columns and move the resizer to the leftmost position, each row stops in a different location.
I'm using Windows8Theme and this happens when using Windows8Theme. Please see the images attached.
Thanks!

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 02 Aug 2013, 11:29 AM
Hello Dodd,

You need to override CanConvertTo method and apply correct rule when this will return true or false. Otherwise, ConvertTo method will not be executed.
Considering the second question, we will investigate the case and try to provide a fix for it as soon as possible. 

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Dodd
Top achievements
Rank 1
answered on 05 Aug 2013, 05:55 AM
Hi Maya,

I think there were some misunderstandings. There are five types of converters in the code I attached, which are


public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)

public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)

public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)


Of these, only the third ConvertTo works and the rest doesn't work.
How can I get them to work in RadPropertyGrid?
0
Maya
Telerik team
answered on 07 Aug 2013, 01:37 PM
Hi Dodd,

Indeed, you are right - I misunderstood the case. I will investigate it and let you know once I have more information for it. Considering the issue with resizing the label column, it is resolved and the fix will be available in the internal build coming on Monday. I have updated your telerik points for reporting the bug. Thanks for the cooperation. 

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Juan Francisco
Top achievements
Rank 1
answered on 27 Sep 2017, 10:57 AM

Hi Maya,

 

We have the same problem with UI for WinForms (version 2017.2.613) when using a Propertygrid and TypeConverter.

The methods

public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)

public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)

does not works.

How can we get work the RadPropertyGrid sucessfully?

 

Regards.

0
Stefan
Telerik team
answered on 02 Oct 2017, 07:09 AM
Hi Juan,

Generally speaking, the UI for WPF RadPropertyGrid component does not share any code base with its UI for Winforms equivalent. Thus, in order to receive the most adequate assistance, I would kindly ask you to post your inquiry in the relevant forum section.

Thank you in advance for your cooperation.

Regards,
Stefan X1
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PropertyGrid
Asked by
Dodd
Top achievements
Rank 1
Answers by
Maya
Telerik team
Dodd
Top achievements
Rank 1
Juan Francisco
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or