SA Developer .NET

Welcome to SA Developer .NET Sign in | Join | Help
in Search

DesktopCompatible(false) control inside another control (Compact Framework 2.0)

Last post 07-24-2008, 11:22 by GrahamD. 0 replies.
Sort Posts: Previous Next
  •  07-24-2008, 11:22 13641

    • GrahamD is not online. Last active: 2008-11-19, 16:32 GrahamD
    • Top 25 Contributor
      Male
    • Joined on 04-12-2007
    • Dinwiddie / Germiston / Johannesburg / Gauteng /ZA
    • Posts 113

    DesktopCompatible(false) control inside another control (Compact Framework 2.0)

    Hi, All

    I have a user control, ControlA, which has specifically been marked as NOT DesktopCompatible. This works fine, normally. If I drag this control onto a Windows Form in designer, I get that "placeholder" control, indicating that the control is not desktop compatible.

    I have another user control, ControlB, which I have also specifically marked as NOT DesktopCompatible (It actually IS compatible, except that it contains ControlA). In the designer of ControlB, the behaviour is correct, and ControlA displays as a "placeholder". However, when I try and add ControlB to a Windows Form in designer (Or open a form that contains ControlB), Visual Studio crashes, complaining about how it cannot find coredll.dll.

    I have two possible solutions:

    1. How can I get the designer to respect the DesktopCompatible(false) attribute of ControlB, so that it doesn't try to invoke the internal P/Invoke calls from ControlA?
    2. Since I have access to the source code of both ControlA and ControlB, I could make both controls DesktopCompatible by wrapping any P/Invoke calls in #if design preprocessor directives. But this is not working! Sad How do I get C# to know if code is running in designtime or not?

    Cheers
    Graham


    Visit http://www.communicate.za.net/ and talk about anything but work! Well... I suppose if you really HAVE to talk about work... Stick out tongue
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems