Click here to Skip to main content
Click here to Skip to main content

Converting WinForms => Web Forms using CodeDom

By , , 10 Feb 2005
 

Sample Image - WinForms2WebForms.gif

Contents

Introduction

Every so often, client projects have a requirement to provide both a Windows Forms and a browser-based front end. Usually, the Windows Forms application provides all the features whereas the HTML version is a somewhat "lightweight" variant of it. Since both types of user interfaces access the same business logic, it would be convenient to be able to convert Windows Forms UIs to Web Forms, thus saving development time which is otherwise spent on tedious duplication of existing Windows Forms in the Web Form Designer. This article demonstrates a possible approach to achieving a transformation of Windows Forms UIs to ASP.NET Web Forms.

Disclaimer

Please note that it is not the intention of this article or the accompanying code sample to achieve a complete conversion between Windows Forms and Web Forms including all events and business logic. Due to the fundamentally different nature of the two programming models, this would be a fruitless attempt. Rather, we are targeting the user interface components themselves, mapping Windows Forms controls to appropriate Web Forms counterparts. If you are binding your forms to business classes — and we are sure you do — you are still responsible for retrieving instances of them from the data store and writing back changes entered by the user.

Background

The main problem in attempting a direct conversion between Windows Forms and Web Forms is mapping controls and their properties to each other.

Let's take a System.Windows.Forms.TextBox control, for example. The obvious choice for its match in the System.Web.UI namespace would be a System.Web.UI.WebControls.TextBox control. That's easy. A closer look at the properties of the two types, however, reveals quite a number of mismatches: mapping a Windows Forms control's Name property to the ID property of its Web Forms counterpart isn't too difficult. But what about properties like Anchor, BindingContext and SelectedText? No matter how hard you try, you're not going to find corresponding Web Control properties. After all, Web Controls are ultimately rendered as HTML which only provides a small subset of the features available to Windows Forms applications. Therefore, you'll have to do without a significant number of Windows Forms properties, and limit yourself to the most basic ones, specifically those determining position and size.

How it works

The central class of the sample, Convert2Aspx, contains a single public method, Convert, and a number of properties to customize the Web Form conversion process. You can set the desired output language (SourceLanguage) and whether you want to create a page or a user control (AspxType).

The Convert method takes two arguments: the form or control to be converted and the path the output files are to be written to. It creates both an aspx/ascx file and a corresponding code-behind file, in the provided location. Control declarations are inserted in the aspx/ascx file, and appropriate methods and variable declarations get added to the code-behind, just the way Visual Studio .NET does it. Correct positioning is achieved using Cascading Style Sheets (CSS) instructions, which are correctly interpreted by all modern browsers.

Using the code

The Convert2Aspx class allows you to create web form pages (*.aspx) as well as user controls (*.ascx). You determine the output format by setting the AspxType enum property to either AspxTypes.Page or — you guessed it — AspxTypes.UserControl. Pick your target language of choice, C# or VB.NET, by setting the SourceLanguage property to the desired value, and call the Convert method. Two snippets illustrating the use of the class follow below.

Converting a System.Windows.Forms.Form instance to a Web Forms page:

convert2Aspx = new suite4.net.WinForms2WebForms.Convert2Aspx();
convert2Aspx.AspxType = suite4.net.WinForms2WebForms.AspxTypes.Page;
convert2Aspx.SourceLanguage = suite4.net.WinForms2WebForms.SourceLanguages.C_Sharp;
convert2Aspx.Convert(this, @"C:\WinForms2WebForms");

Converting a System.Windows.Forms.GroupBox instance to a Web Forms user control:

convert2Aspx = new suite4.net.WinForms2WebForms.Convert2Aspx();
convert2Aspx.Namespace = "suite4.net.WinForms2WebForms";
convert2Aspx.RootName = "grpAdress";
convert2Aspx.FullName = convert2Aspx.Namespace + "." + convert2Aspx.RootName;
convert2Aspx.AspxType = suite4.net.WinForms2WebForms.AspxTypes.UserControl;
convert2Aspx.SourceLanguage = suite4.net.WinForms2WebForms.SourceLanguages.C_Sharp;
convert2Aspx.Convert(this.grpAdress, @"C:\WinForms2WebForms");

Notice how in the second example the Namespace, RootName and FullName properties are explicitly set. Doing so allows you to manipulate various naming-related properties in the conversion output. If you simply call Convert without bothering about them, the property values are read from the form or control passed to the method as the first argument.

Using the sample

The demo project accompanying this article takes a simple Windows Form and converts it to both a Web Form (as shown at the top of this page) and a Web Forms user control. To see the conversion in action, do the following:

  1. Create a directory named "WinForms2WebForms" on your C: drive.
  2. Using Internet Information Services (IIS) Manager, create a virtual directory pointing to the folder created in step 1. Name it "Win2Web" or anything else that suits your fancy.
  3. Open Visual Studio .NET and create a new ASP.NET web project in C#. Enter http://localhost/<Name-from-Step2>/ as the storage destination. Visual Studio .NET will create a new web project and store the files in C:\WinForms2WebForms.
  4. Delete WebForm1.aspx from the project.
  5. Open this article's demo project and run it. Click "Write to aspx" when the sample form appears. The Web Form pages and code-behind files are written to the directory designated in step 1.
  6. Go back to the web project and click View > Refresh in Visual Studio's main menu. The newly created files will now be visible in the Project Explorer. If they don't appear, click Project > Show all files. You should now be able to see them in the Project Explorer.
  7. Right-click on each of the new files and include them in the project.
  8. Build and run the project after you have set Form1.aspx as the start page. Your browser will display the converted form.

Code generation

The conversion process entails creating two different file types for each Web Forms page or user control:

  1. the aspx/ascx file, and
  2. its corresponding code-behind file as a C# or Visual Basic class file.

Let's have a quick look under the hood of generating each of them.

Creating the aspx/ascx file

For the aspx/ascx file, we opted to generate the code using a System.Text.StringBuilder class. The generation is pretty straight-forward and consists of inserting the common page elements like the <html>, <head> and others, and then looping through each control placed on the Windows Form to generate its ASP.NET declaration, such as <asp:TextBox id="myTextbox" runat="server" style="[...]" />.

The reason we chose to go with a simple StringBuilder for this task is that the aspx/ascx files are pretty much language-independent and C#/VB.NET syntax is not relevant for them. All that needs to be adjusted is the <%@ Page [...] %> declaration at the top of the file, the remaining content is dominated by HTML and ASP.NET control declarations.

The snippet below is taken from the ConvertControls method of the Convert2Aspx class, to illustrate the basic conversion algorithm:

foreach(System.Windows.Forms.Control control in rootControl.Controls)
{
    if(control is System.Windows.Forms.Label)
    {
        webLabel = new System.Web.UI.WebControls.Label();
        webLabel.ID = control.Name;
        this._WebControls.Add(webLabel);
        stringBuilder.Append(" <asp:Label");
        this.AddProperties(control, stringBuilder);
        stringBuilder.AppendFormat(">{0}</asp:Label>{1}", control.Text, 
            System.Environment.NewLine);
    } 
    else if(control is System.Windows.Forms.TextBox)
    {
        webTextBox = new System.Web.UI.WebControls.TextBox();
        webTextBox.ID = control.Name;
        this._WebControls.Add(webTextBox);
        stringBuilder.Append(" <asp:TextBox");
        this.AddProperties(control, stringBuilder);
        stringBuilder.AppendFormat(">{0}</asp:TextBox>{1}", control.Text, 
            System.Environment.NewLine);
    } 
    (...)
}

The excerpt converts System.Windows.Forms.Label and System.Windows.Forms.TextBox controls to their ASP.NET counterparts. The AddProperties method used above is responsible for assigning the required CSS style instructions to the ASP.NET control declaration. It looks like this:

private void AddProperties(System.Windows.Forms.Control control, 
                System.Text.StringBuilder stringBuilder)
{
    stringBuilder.AppendFormat(" id=\"{0}\"", control.Name);
    stringBuilder.AppendFormat(" style=\"z-index:{0}; " + 
        "left:{1}px; top:{2}px; font-family:'{3}'; " + 
        "font-size:{4}pt; position:absolute;\"", 
        this._ZIndex++, control.Left, control.Top, 
        control.Font.FontFamily.Name, (int)control.Font.Size);
    stringBuilder.Append(" runat=\"server\"");
    stringBuilder.AppendFormat(" Width=\"{0}\"", control.Width);
    stringBuilder.AppendFormat(" Height=\"{0}\"", control.Height);

    if(control is System.Windows.Forms.TextBox)
    {
        stringBuilder.AppendFormat(" TabIndex=\"{0}\"", control.TabIndex);
    }
}

So far, so good. We now know how to properly deal with Label and TextBox controls. But what if they are not simply child controls of the main form but are themselves part of, say, a System.Windows.Forms.Panel or System.Windows.Forms.GroupBox? The answer is — quite obviously — recursion. The following snippet is again taken from the ConvertControls method and illustrates how to go about converting a System.Windows.Forms.GroupBox:

else if(control is System.Windows.Forms.GroupBox)
{
    stringBuilder.Append("<fieldset");
    stringBuilder.AppendFormat(" ID=\"{0}\" runat="\""server\"", control.Name);
    stringBuilder.AppendFormat(" style=\"POSITION:" + 
        " absolute; left: {0}px; top: {1}px; width:{2}px; 
        height: {3}\"", control.Left, control.Top, 
        control.Width, control.Height);
    stringBuilder.AppendFormat(">{0}", System.Environment.NewLine);
    stringBuilder.Append("<legend");
    stringBuilder.AppendFormat(" style=\"Z-INDEX: {0}; " + 
        "color:black; font-family:'{1}'; font-size:{2}pt; width=\"", 
        this._ZIndex++, control.Font.FontFamily.Name, 
        (int)control.Font.Size);
    stringBuilder.AppendFormat(">{0}</legend>{1}", 
                  control.Text, System.Environment.NewLine);
    this.ConvertControls(control, stringBuilder);
    stringBuilder.AppendFormat("</fieldset>{0}", 
                          System.Environment.NewLine);
    webGroupBox = new 
      System.Web.UI.HtmlControls.HtmlGenericControl("fieldset");
    webGroupBox.ID = control.Name;
    this._WebControls.Add(webGroupBox);
}

Here, we're taking advantage of HTML's relatively little-known <fieldset> tag to emulate the visual appearance of the System.Windows.Forms.GroupBox control. You can view the result in the screenshot at the top of this page.

The sample class Convert2Aspx currently only converts System.Windows.Forms.Label, System.Windows.Forms.TextBox and System.Windows.Forms.GroupBox controls to their ASP.NET counterparts. However, using the principles outlined in this article, support for further control types can easily be added.

Creating the code-behind file

Code-behind files are written entirely in C# or VB.NET and, therefore, require thorough consideration of syntax and language features. Generally, there are two common options for approaching C#/VB.NET code generation:

  1. Create a template with placeholders for the controls and other parameters, fill the placeholders dynamically with the Windows Form control properties. Disadvantage: you have to create and maintain one template for each required output language, resulting in potential synchronization faults if you make a change to one template and forget to amend the other or others, too.
  2. Use the classes from the System.CodeDom namespace to dynamically create the code-behind files in the correct syntax for either language. Maintenance is no problem with this approach since there is only one source file to be maintained — the one containing your source code.

Since templates are limited in use and can become quite unwieldy as their complexity increases, we opted for using CodeDOM for generating the code-behind files. This is no article about the use of CodeDOM, so we're not going to go into too much detail here, but as you'll see, the code is quite self-explanatory. Here's an excerpt from the Convert2Aspx class which creates a Page_Load method in the code-behind file:

private void BuildPageLoadMethod(System.CodeDom.CodeTypeDeclaration 
                                                            typeDeclaration)
{
  System.CodeDom.CodeMemberMethod codeMethodPageLoad;
  System.CodeDom.CodeParameterDeclarationExpression 
                             codeParameterExpression;

  // Add Page_Load method
  codeMethodPageLoad = new System.CodeDom.CodeMemberMethod();
  codeMethodPageLoad.Name = "Page_Load";

  // Add sender parameter
  codeParameterExpression = new 
      System.CodeDom.CodeParameterDeclarationExpression(typeof(object), 
      "sender");
  codeMethodPageLoad.Parameters.Add(codeParameterExpression);

  // Add eventargs parameter
  codeParameterExpression = new 
      System.CodeDom.CodeParameterDeclarationExpression(
                         typeof(System.EventArgs), "e");
  codeMethodPageLoad.Parameters.Add(codeParameterExpression);
  typeDeclaration.Members.Add(codeMethodPageLoad);
}

The above statements create an empty method that accepts two parameters and produces the following output in C#:

private void Page_Load(object sender, System.EventArgs e)
{
}

You can find a number of similar methods in the Convert2Aspx class that all work essentially the same way. Studying them will soon give you a feeling for how to "think" with the CodeDOM. And the big advantage of using it is that changing or expanding functionality in the generated code requires modifications at a single location only.

Revision History

  • 14 Jan 2005: Original article published.
  • 09 Feb 2005: Update submitted which includes the following changes:
    • Added support for nested controls.
    • Added a clarification of the procedure for using the sample code.
    • Added table of contents for the article.
    • Various minor edits and corrections.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Authors

Hardy Erlinger
Web Developer
Germany Germany
Member
Hardy is an independent consultant and developer located in Munich, Germany. He spezializes in ASP.NET development and runs the .NET Developers Group Munich since April 2003.
 
Company website: www.netspectrum.de

ASommer
Web Developer
Germany Germany
Member
.NET developer based in Munich, Germany. Specialising in development automation and code generation for software developers using .NET.
 
Owner and Developer of form.suite4.net

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralThanks so MuchmemberKike Rios8 Nov '12 - 1:03 
I am very glad to the people on this site. you're my Right hand!!!
 
special Thanks to Hardy Erlinger
QuestionVBmembersiriusian162 Jul '12 - 1:47 
Hello guys I know its kinda late and so long past over this project but I'm looking for VB codes of this project now I know it's better if I use c# but unfortunately I already developed a complex vb project and it will take lots time to translate it to vb if some still have Piero Viano's project can you guys send it to me or post it somewhere. thanks in advance..
GeneralVisual WebGuimemberdudegizmox12 Sep '06 - 20:29 
Very impressive piece of code you have published here.
 
I wanted to point out a new framework that enables you to simple port your WinForms code to the web. This includes not only form layout but full application behaviors including windowing ,data binding and so on. Visual WebGui is a new web development framework that extends ASP.NET to provide full WinForms like API and design time capabilities. This dramatically cuts development time for rich internet applications with out compromising on the result. Visual WebGui is not a code generator or converter but rather a run time library that enables WinForms model over web using a unique communication layer.
 

Check this sample here:
http://samples.visualwebgui.com/MainForm.wgx(currently only functional on IE browsers - FireFox support will be published during the next few weeks).
 
And the technology site here:
http://www.visualwebgui.com
GeneralYour source was modified by me.memberPiero Viano22 Oct '05 - 19:28 
Hi.
My compliments for your work!
My name is Piero and I'm from Italy.
I'm a .Net developer from its beginning.
I think your source is beutiful.
Anyway, I think it could be made a little better.
I upgraded your source in a way that page or control formatting is based on HTML Tables and there is no limit in the recursion in controls contasined in the form. There are more controls supported than in your code. Any unsupported control becomes a 'span'. It's not the mazimum, but is better than nothing!
I added the possibility to transform any windows form to asp.net web form simply browsing the assembly and choosing the form class contained in it.
 
I translated your source code in VB.Net because I like that language (obviously with option strict on!) with some tools that I own.
If you think my modifications are good, I've no problem to share my (and your witch my code is based, I'm sorry) source code with anyone.
This is my email adress: piero.viano@email.it.
 
Best regards.
Piero
 
Piero Viano
NewsRe: Your source was modified by me.memberantecedents3 Feb '08 - 8:00 
This is under a C# category so I doubt anyone is going to want your VB source! C# has a much cleaner syntax and is more powerful than VB. It has also been benchmarked against many C++ compilers and has been found to be faster, especially when using NGen to create a native image of the application.
 
So I know for certain I sure as hell would not want to even read your source!
 
Maybe you could try to post this under your own Article in the VB category though!
---
Will.
Generalsimilar toolmemberGoAn11 Feb '05 - 3:01 
hi!
 
i made a similar tool but instead of converting windows forms to web forms it converts windows forms to wx widgets toolkit that is cross platform. you can check it out at http://swfwidgets.pt.vu/
GeneralRe: similar toolmemberASommer11 Feb '05 - 8:52 
Hello GoAn,
SWF Widgets sure looks like a very interesting project. Thanks for the link.
How do you generate the code? CodeDOM or templates?
Please be aware that the code covered in the article is only a subset of the functionality we're providing in our form.suite4.net product. Not sure if we're going to include Mono-support, though. The existing demand for Mono doesn't seem to be high enough -- yet.
 
Regards,
 
Ansgar Sommer
 
reduce presentation layer design time by using form.suite4.net
GeneralRe: similar toolmemberGoAn11 Feb '05 - 13:40 
i use templates to generate the source code.
GeneralRe: similar toolmemberASommer11 Feb '05 - 13:49 
I think using CodeDom is more flexible, we have played also a little with Delphi for .NET and it works.
 
Boost the efficiency of creating the presentation layer -- form.suite4.net
GeneralMS LongHorn model .........membersandurea8 Feb '05 - 2:00 
Hi ,
 
Is this what you are trying to do is something similar to MS LongHorn Model........,
 
check out the following link.
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnintlong/html/longhornintro.asp
 

 
Thanks
 
Nitin Sandurea Smile | :)
GeneralRe: MS LongHorn model .........memberASommer9 Feb '05 - 4:00 
Hi Nitin,
 
Actually, when we wrote the article, we didn't have Longhorn in mind. XAML is a declarative way of creating Longhorn UIs while the approach we outline in the article uses .NET Framework code generation techniques to turn a Windows UI into ASP.NET pages.
 
It would be possible, of course, to generate basic XAML files from the Windows Forms classes, but that would have to be the topic of a separate article.
 
Regards,
 
Ansgar
GeneralProblems Using the samplemembervbman2004x23 Jan '05 - 8:31 
Trying to run the sample in step 6 I have problems:   ".....click on View > Refresh in VS's main menu.   The newly created files will now be visible in the Project Explorer."
I don't see the newly created files.   Everything up to this point worked OK.
I checked and they are in the folder "WinForms2WebForms".   I have doubled checked everything I can think of, spelling, permissions, etc. Any ideas why I wouldn't see the files.      Thanks for any assistance!

 
Dan Lundy
GeneralRe: Problems Using the samplememberHardy Erlinger23 Jan '05 - 11:59 
Hi Dan,
 
you may need to tell VS .NET to display *all* files by clicking on the "Show all files" button in the Project Explorer. It sits at the top of the Project Explorer panel, the 5th button from the left. By default, VS.NET only shows the files currently present in a project and hides any other files that might be in the project directory. That should do the trick.
 
HTH,
 
Hardy Erlinger
 
----------------------
Hardy Erlinger
Netspectrum
http://www.netspectrum.de
GeneralRe: Problems Using the samplememberdblanchard23 Jun '06 - 12:22 
Hello Ansgar and Hardy,
 
Thanks for a cool project. I'm also having trouble with the example. By way of disclaimer, I'm a decent enough Perl programmer, but am new to .Net and C#, though I have a bit of classic ASP experience.
 
First, my setup: Win XP Pro running Visual Studio 2005 Pro with C#. I have some issue trying to start webprojects because my interface seems to be different than those I read about online. When I run the demo project, the file listing appeared to change, but I'm not certain. I can see:
 
Solution 'Win2Web (2)' (1 Project)
|
-- http://localhost/Win2Web/
|
-- App_Data
-- Default.aspx.cs
-- Form1.aspx
| |
| -- Form1.aspx.cs
-- Form1UC.ascx
|
-- Form1.ascx.cs
 
When working on C++ projects I have project menu available, but not when working on web projects. So, I can't "Show all."
 
I'm note certain whether I should be able to see more. In my C:\WinForms2WebForms directory, I have:
 
App_Data (empty)
Default.aspx.cs
Form1.aspx
Form1.aspx.cs
Form1UC.ascx
Form1UC.ascx.cs
 
So, the output (errors) I'm getting at compile time:
 
------ Build started: Project: http://localhost/Win2Web/,
Configuration: Debug .NET ------
Validating Web Site
Building directory '/Win2Web/'.
C:\WinForms2WebForms\Form1.aspx(1): Build (web): Could not load type
'suite4.net.WinForms2WebForms.Form1'.
C:\WinForms2WebForms\Form1UC.ascx(1): Build (web): Could not load type
'suite4.net.WinForms2WebForms.Form1'.
 
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
 

In reading all the other posts here, I found this page http://www.suite4.net/products/downloads/default.aspx and wondered whether I need to have form.suite4.net V1.5 standard installed. I've downloaded it and am trying it now. I'll update this when I'm done.
 
Thanks for any help.
GeneralRe: Problems Using the samplememberdblanchard23 Jun '06 - 13:20 
After installing form.suite4.net V1.5 and running the application, I got an alert that two new files had been added to my directory, but I don't see any new files there or in the solution explorer.
 
Anyhow, one thing that would really help me is if someone could point me at a resource taht shows the relationships between Windows controls and web controls. I know from the article for example that System.Web.UI.WebControls.TextBox is a close match for System.Windows.Forms.TextBox. If I could find a listing of all the Windows controls and their near-matching web controls I would feel like I'm making some progress.
 
Thanks all.
 
DBlanchard
GeneralDeclarative ProgrammingprotectorMarc Clifton15 Jan '05 - 7:42 
OK, shameless plug here, but it's interesting the approach you've taken, vs. the approach that Justin and I took:
 
http://www.codeproject.com/csharp/declarativewebform.asp[^]
 
Nice article.
 
Marc
 
MyXaml
Advanced Unit Testing
YAPO
 

GeneralRe: Declarative ProgrammingsussASommer16 Jan '05 - 3:54 
Hello Marc,
 
I have been monitoring your work in the past and will continue to do so. The drawback I see in basing the design of both Windows Forms and Web Forms on an XML dialect is the lack of support for graphical designers. That's why I decided to take the approach laid out in the article. The converter described there is a simple subset of functionally that we provide with form.suite4.net. For example we convert TabControls, GroupBoxes etc. automatically to web forms without the need for an external library.
 
See an example here:

http://suite4.net/default.aspx?ActiveMain=0&ActiveData=0_7_05

 
Ansgar Sommer
suite4.net
GeneralRe: Declarative ProgrammingmemberD A R Kemp18 Jan '05 - 23:56 
Mark
 
I've looked at MyXaml, and whilst it seems great for WinForms, you need to make changes to the declarations to get them to work for WebForms. The examples that you have[^] are, I'm loathed to say, trivial.
 
You also face the problem that WebForms development is already declaritive, and the ASPX declarations are a lot more flexible than the MyXaml ones.
 
For example, ASPX allows you to use any attribute for a tag, which, if it doesn't match a property, it simply passes through to the generated HTML.
 
For example:
 
<asp:Label runat="server"onMouseover="alert('Hello');" >This is a label</asp:Label>
 
generates:
 
<span onMouseover="alert('Hello')">This is a label</span>
 
This allows WebForms programmers to add client side interactivity, which is a must. Every Postback (form submission) results in a round trip to the server, which is a very expensive transaction, and annoying for users. Consider using your calculator example across a slow connection (GPRS?), it's not nice having to wait 20 seconds or so every time a button is pressed...
 

Also, there are a load of attributes of the properties on WebControls, which allow your to write things like
<asp:Label runat="server">This the the label text</asp:Label>
and map the content of the <asp:Label> node to the Text property of the Label object (see PersistenceModeAttribute[^], for example).
 

The other thing I've noticed is that all your WebForms examples use absolute positioning, which, in the web-design arena, is a big NO. WebForms should to be designed to work for anyone, regardless of the size of their browser. (Good) WebForms should work equally as well on a 800x600 (does anyone use 640x480?) sized browser as they do with a 2048x1536 one, and we increasingly have to think about people with browsers on other devices. I use the browser on my SmartPhone[^] when I'm out and about, and you'd be amazed at how well it renders a well designed website on its tiny screen. On my phone, the calculator example displays everything in a line, as the browser doesn't support absolute positioning. WebForms programmers (should) put effort into making their designs work on all these devices, and also for people with text-only browsers[^], as not everyone uses the bells and whistles browsers (IE, NS6+, Mozzilla, FireFox, Opera, etc) (http://www.w3.org/WAI/[^]).
 

IMHO: The problem with MyXaml is that it's been designed from a WinForms perspective. A better place to start might have to been to abstract away from any specific implementation of UI, and leave different renderers to handle how they translate the MyXaml document into a user interface. This would allow, for example, the same MyXaml document to render across WinForms and WebForms without having to know about implementation specific issues. Of course, this would require factoring out the functionality of both WinForms and WebForms, and, unless you're carefull, you'd end up with something that's use to neither WinForm or WebForm designers.
 
I'm not knocking MyXaml, I think it's great to have declaritive WinForms, but it still has to do a lot to convince me that I can use it for my WebForms development.
 
</rant>
GeneralRe: Declarative ProgrammingprotectorMarc Clifton19 Jan '05 - 3:50 
You bring up excellent points. Of course the MyXaml form->web example is trivial, it was meant to be a demonstration only, not something you would ever do in production.
 
D A R Kemp wrote:
The problem with MyXaml is that it's been designed from a WinForms perspective.
 
Well, not really. It's just a generic instantiator. The problem is that the web forms namespace isn't very friendly to this kind of approach. This would require custom parsing, which I don't want to add to MyXaml.
 
D A R Kemp wrote:
A better place to start might have to been to abstract away from any specific implementation of UI, and leave different renderers to handle how they translate the MyXaml document into a user interface.
 
This is, IMO, a different beast than the goals of MyXaml. However, I completely agree, in fact, I'm doing something like this for a client, where we use MyXaml to instantiate wrappers that then render the document based on the UI platform.
 
D A R Kemp wrote:
but it still has to do a lot to convince me that I can use it for my WebForms development.
 
Agreed! Smile | :)
 
Marc
 
MyXaml
Advanced Unit Testing
YAPO
 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 11 Feb 2005
Article Copyright 2005 by Hardy Erlinger, ASommer
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid