public override string ToString(object v)
            {
                // If the value is the object's current value, then ask GetDisplay string first. This is a perf
                // improvement because this way we don't populate the arrays when an object is selected, only
                // when the dropdown is actually opened.

                if (_target.IsCurrentValue(v))
                {
                    bool success = false;

                    string displayString = GetDisplayString((Oleaut32.IPerPropertyBrowsing)_target.TargetObject, _target.DISPID, ref success);

                    if (success)
                    {
                        return(displayString);
                    }
                }

                // Couldn't get a display string... do the normal thing.
                EnsureArrays();
                return(base.ToString(v));
            }
Exemplo n.º 2
0
            public override string ToString(object v)
            {
                // If the value is the object's current value, then
                // ask GetDisplay string first.  This is a perf improvement
                // because this way we don't populate the arrays when an object is selected, only
                // when the dropdown is actually opened.
                //
                if (target.IsCurrentValue(v))
                {
                    bool success = false;

                    string displayString = Com2IPerPropertyBrowsingHandler.GetDisplayString((NativeMethods.IPerPropertyBrowsing)target.TargetObject, target.DISPID, ref success);

                    if (success)
                    {
                        return(displayString);
                    }
                }

                // couldn't get a display string...do the normal thing.
                //
                EnsureArrays();
                return(base.ToString(v));
            }