...
Generally speaking, the WPF/VB.NET sample will be analogous to the WPF/C# sample. However, the problems are in the details: I initially find the WPF subsystem contains several C#-specific patterns in vbcontrols.xml; for example there example, there are a int
and double
casts as well as a few other C# patterns relating to data binding; for example:
Code Block | ||
---|---|---|
| ||
<pattern id="Top.Set" > <wpf narg="2" code="Canvas.SetTop(%2d,(double)(%1d))\c" /> <all narg="2" code="%2d.Top = %1d\c" /> </pattern> |
What is needed here is a VB.NET form for some WPF operations. This is analogous to the situation with SubSystem=loc/lob
where some patterns need both a VB.NET and a C# form. For WPF we will need a pair of subsystems, wpf/wpb, for C#/VB.NET respectively. The new subsystem is added to enumerations.xml:
...
...
A critical part of supporting the WPF upgrade relates to authoring XAML from the VB6 forms and declaring the WPF Application class. This work is done in the wpfSubSystem.gmsl script. This gmSL script contains various upgrade event handlers and supportig supporting routines that are called by gmBasic at the appropriate times during the authoring process. Support for VB.NET was added by making the code in wpfSubSystem.gmsl dialect-specific: adding logic to author either C# or VB.NET code depending on the dialect setting.
...
Code Block | ||
---|---|---|
| ||
<gmSL NameSpace="gmSL" class="WPFSubSystem" Source="%UserFolder%\WPFSubsystem.gmsl" /> <gmSL NameSpace="gmSL" class="WPBSubSystem" Source="%UserFolder%\WPFSubsystem.gmsl" /> <-------------- added |
...
...
Code Block |
---|
<Select SubSystem="wpf"/> |
The above now works for both Dialect=csh and Dialect=vbn. Note: the WPF upgrade subsystem is a limited implementation: it supports most VB6 intrinsic controls and the COM TabControl (TabDlg). Additional VB6/COM controls and other features may be added by modifying the appropriate language scripts and COM description files. Contact us if you have any questions.