in src/Core/Bases/A11yProperty.cs [78:147]
public override string ToString()
{
string txt = null;
if (this.Value != null)
{
switch (this.Id)
{
case PropertyType.UIA_RuntimeIdPropertyId:
txt = this.ConvertIntArrayToString();
break;
case PropertyType.UIA_ControlTypePropertyId:
txt = this.Value != null ? ControlType.GetInstance().GetNameById(this.Value) : "";
break;
case PropertyType.UIA_BoundingRectanglePropertyId:
// if bounding rectangle is [0,0,0,0], treat it as non-exist. same behavior as Inspect
txt = GetBoundingRectangleText();
break;
case PropertyType.UIA_OrientationPropertyId:
switch ((int)this.Value)
{
case 0: //OrientationType_None
txt = "None(0)";
break;
case 1: //OrientationType_Horizontal
txt = "Horizontal(1)";
break;
case 2: // OrientationType_Vertical
txt = "Vertical(2)";
break;
}
break;
case PropertyType.UIA_PositionInSetPropertyId:
case PropertyType.UIA_LevelPropertyId:
case PropertyType.UIA_SizeOfSetPropertyId:
/// these properties are 1 based.
/// if value is smaller than 1, it should be ignored.
if(this.Value != null && this.Value > 0)
{
txt = this.Value?.ToString();
}
break;
case PropertyType.UIA_HeadingLevelPropertyId:
txt = HeadingLevelType.GetInstance().GetNameById(this.Value);
break;
case PropertyType.UIA_LandmarkTypePropertyId:
txt = this.Value != 0 ? LandmarkType.GetInstance().GetNameById(this.Value) : null; // 0 is default value.
break;
default:
if (TypeConverterMap.TryGetValue(Id, out ITypeConverter converter))
{
txt = converter.Render(Value);
}
else if (this.Value is Int32[])
{
txt = ((Int32[])this.Value).ConvertInt32ArrayToString();
}
else if (this.Value is Double[])
{
txt = ((Double[])this.Value).ConvertDoubleArrayToString();
}
else
{
txt = this.Value?.ToString();
}
break;
}
}
return txt;
}