PropertyGrid problems in 2013 Q2

4 posts, 0 answers
  1. Dodd
    Dodd avatar
    44 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. UI for WPF is Visual Studio 2017 Ready
  4. Dodd
    Dodd avatar
    44 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?
  5. 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 >>
Back to Top