In custom Windows Mobile Control, what is the correct XMTA to handle encoding / serialization of null images for properties?

I am creating a Windows Mobile Compact Framework user control that has additional images as properties. Usually I don’t worry about supporting development time, in which case I need to make it available. If an optional image is missing and the developer tries to update the code, Visual Studio throws an exception

"Error generating code for the" MyImage "property. Error:" The reference to the object is not installed in the instance of the object "

I have an XMTA file and you tried to use different combinations, including different values ​​for "DesignerSerializationVisibility". Either the code for the property is not generated, or an exception is thrown if an optional image is missing. If an image is present, everything works fine.

+3
source share
1 answer

I just looked at the Smart Device Framework, and this is what we do in XMTA:

<Property Name="ActiveBackgroundImage">
    <Category>Appearance</Category>
    <DefaultValue>
        <Type>System.Drawing.Image, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Type>
    </DefaultValue>
    <Description>The background image displayed for the control in an active state.</Description>
</Property>

Note the missing item <Value>in <DefaultValue>. I assume that leaving it outside the default null;

+3
source

Source: https://habr.com/ru/post/1790745/


All Articles