PropertyGrid problems in 2013 Q2

6 posts, 0 answers
  1. Dodd
    Dodd avatar
    45 posts
    Member since:
    Dec 2012

    Posted 31 Jul 2013 Link to this post

    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!

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 02 Aug 2013 Link to this post

    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 >>
  3. Dodd
    Dodd avatar
    45 posts
    Member since:
    Dec 2012

    Posted 05 Aug 2013 Link to this post

    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?
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 07 Aug 2013 Link to this post

    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 >>
  5. Juan Francisco
    Juan Francisco avatar
    1 posts
    Member since:
    Aug 2016

    Posted 27 Sep in reply to Maya Link to this post

    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.

  6. Stefan
    Admin
    Stefan avatar
    799 posts

    Posted 02 Oct Link to this post

    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.
Back to Top