c# - How to show property descriptions in Windows Store App User Control? -
i use description attribute custom properties in wpf user control below.
[category("features"), description("you can setup image width ratio in double type")] public double imagewidthratio { { return (double)getvalue(imagewidthratioproperty); } set { setvalue(imagewidthratioproperty, value); } } // using dependencyproperty backing store imagewidthratioproperty. enables animation, styling, binding, etc... public static readonly dependencyproperty imagewidthratioproperty = dependencyproperty.register("imagewidthratio", typeof(double), typeof(thecontrol), new uipropertymetadata(1.0));
the line [category("features"), description("you can setup image width ratio")]
gives descriptions groups in properties window.
but, windows store app user control. says no system.componentmodel.desriptionattribute
.
how show property descriptions in properties window in winrt?
add helper class
using system; namespace system.componentmodel { [attributeusage(attributetargets.all)] public class descriptionattribute : attribute { public descriptionattribute(string description) { description = description; } public string description { get; private set; } public override bool equals(object obj) { if (obj == this) return true; var other = obj descriptionattribute; return other != null && other.description == description; } public override int gethashcode() { return description.gethashcode(); } } }
Comments
Post a Comment