OpenNetCF and OrientationAwareControl

Topics: Mobile Client Software Factory
Aug 2, 2006 at 4:06 AM
originally posted by: eekvang


We are trying to create an application that makes use of the Orientation Aware Control block and OpenNETCF. OpenNETCF provides some extra controls that gives additional properties to for example the traditional button control in Visual Studio.

Unfortunately using a button control from OpenNETCF together with the Orientation Aware Control block is not working as intended. When replacing UserControl with OrientationAwareControl a resx file is generated to keep the default properties of the control and the button added to it. Using a normal button, both the location and size property are written to this file, but when using OpenNETCF's button only the location property is written.

The result of this is that the size of the button remains the same for all layouts.

Any suggestions on how to solve this?

Thank you
Aug 2, 2006 at 4:44 AM
originally posted by: dcazzulino

Looks like a bug in the button control you are using. It should have the Localizable attribute for both properties in order for them to be persisted in the resource.

Try using the control and use standard .NET localization and see if it behaves the same.
Aug 2, 2006 at 10:45 PM
originally posted by: eekvang

Do you mean that we should apply Localizable(true) directly to each property, or just to the parent orientation aware control?

From what we have seen, the attribute is not available in .Net compact, therefore it is not possible to assign it directly to the properties. In OpenNETCF the Size property is directly inherited from the System.Windows.Forms.Control class, no modifications of any kind. The same goes for Location property, but this one is written to the resx file as it should.

Aug 3, 2006 at 2:41 AM
originally posted by: dcazzulino

Design-time attributes in the CF are not applied directly to the control's properties. They are specified in an .xmta file. Take a look at the OAC project itself to see how this works.

Have you tried what I said? Using he openetcf control in a plain Localizable=true usercontrol and see if the Size propery is serialized to the resx?
You cannot see the design-time attributes just using reflector or VS metadata browser. You need to open the corresponding .asmmeta.dll file. In the case of OpenNETCF, these files are in C:\Program Files\OpenNETCF\Smart Device Framework 2.0, such as OpenNETCF.Windows.Forms.PocketPC.asmmeta.dll. That's where you will find the design-time attributes that are applied to a given class.