-
2 Attachment(s)
twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
This project demonstrates some of the WinRT and XAML Islands features and how to use them in tB/VB6. It also includes my WinRT Interfaces package that has been published to the twinBASIC server for everyone to use as they see fit (this package is far from complete and will include ongoing updates as more interfaces are added).
The following features are showcased in this XAML Islands demo (besides cramming a bunch of XAML controls on a form :bigyello:):
- LinearGradientBrush for colorful labels
- Opacity/Fade, Scale and Rotation animations (with Cubic EaseInOut functions)
- Theme toggle (Light/Dark) with an interactive, animated Sun/Moon icon
- Attaching events to various controls
- Binding of some controls (ListView and ComboBox) to external sources (arrays of strings in this case) for dynamic content updates
- Attaching a Command object to a button instead of a Click event (for example in this case the Submit button will become available once you type a valid email address in the Email text box)
Attachment 195141
You need to compile the executable to see this project in action. It also works in the IDE but for now that requires editing the manifest on the twinBasic executables. You could do that now with a tool such as Resource Hacker or wait for Wayne to include the manifest in a future version.
Here is the demo project: Attachment 195140
Requirements: Windows 10 or later!
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
twinBASIC (twinBASIC IDE BETA 799) compilation error report:
{ERROR} /XamlIslands/Sources/cXamlUICommand.twin [3,12]: <span>TB5000</span>Missing implementation of member Function GetIIDs(ByRef iidCount As Long, ByRef iidPtr As LongPtr) As HRESULT
{ERROR} /XamlIslands/Sources/cXamlUICommand.twin [3,12]: <span>TB5000</span>Missing implementation of member Function GetRuntimeClassName(ByRef ClassName As LongPtr) As HRESULT
{ERROR} /XamlIslands/Sources/cXamlUICommand.twin [3,12]: <span>TB5000</span>Missing implementation of member Function GetTrustLevel(ByRef TrustLevel As TrustLevel) As HRESULT
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Wayne has already fixed that (you should probably join the tB Discord channel as well), get yourself the latest tB! :D
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Works a treat, beautiful animations. Really nice work bro, never would have thought that was possible.
TB gets colorful with it
https://www.vbforums.com/images/ieimages/2025/07/3.png
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Cheers mate! Those extraneous colors are a bug due to the use of generics in that module. Wayne will fix that in due time.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Quote:
Originally Posted by
VanGoghGaming
Wayne has already fixed that (you should probably join the tB Discord channel as well), get yourself the latest tB! :D
Oops! Am I THAT far behind? It is hard to keep up with the releases!
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Yup, that fixed it. Thanks VG.
Very nice interface for a VB6 application and now a TB version to boot...
Now, tell the truth, if a new VB6/TB-er tried to create such a UI for a complex form containing multiple tabs with 2-300 controls to lay out. How long would it take to create the layout of the form, perfecting the positioning but excluding the logic?
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
For your next trick, if you felt like using your new-found knowledge to start the creation of a form designer using XAML islands, then it could possibly start the beginning of a community driven project to adopt something that could be used for RAD within TB.
I don't accept the arguments that it is not possible to have such a designer due to the nature of flow design. We have had HTML designers for decades. I don't have the knowledge to support that statement but I know I won't ever again create such designs without something that approximates to a RAD forms layout designer. It does not have to be perfect.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
It's not for the faint of heart to be sure, it requires a massive effort on learning new stuff (there are dozens of XAML controls that can be used to fulfil your needs), learn to embrace your favorite flavor of AI and ask it all sorts of stupid questions like I did whenever I didn't understand something. It's become surprisingly literate as of late. For example it called my app a retro-futuristic wizardry! :D
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
A little digging and such tools exist. Worth using as a designer then porting the XAML to VB/TB?
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Try it and see how it goes. There are significant differences between WPF and UWP in terms of XAML syntax (you want UWP for this). I had to repeatedly instruct Copilot that I want the UWP version. Also since this is not .NET it won't work with events and triggers and other stuff declared directly in XAML. For example I added the events after loading the XAML in the sample above.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
I'll consider that. I am not going to re-write my configurations screens any time soon as I rather prefer the old Win2000/XP classic look and feel - with the use of an-old style serif font, it completes the picture, for me at least.
However, if I have to create a more user-acceptable UI, perhaps a collaboration with my boy who is doing computing as a subject, then I might delve into it. I see its potential.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
First of all, I'd like to express my utmost respect to VanGoghGaming for taking on the WinRT topic and making much more progress than I have with my small and modest attempts at XAML Islands. At some point, there will surely be a designer. I'm pretty sure of that.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Great work vangaghgaming is impressive.
Franky has already done a great job but yours goes more.
Continuous with great work.
All the best
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Hi VanGoghGaming! The demo project is no longer compatible with WinRT Interfaces version 1.6.0.134. I tried modifying part of the source code, but encountered an error at the NewString method.
-
1 Attachment(s)
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Oh haha, no kidding, I forgot about this old experiment with WinRT and XAML Islands. I chuckled a bit looking at the screenshot above where I was using Select Case statements for runtime class names. These days they are retrieved automatically from the system metadata files.
Here's an updated version that works with the latest WinRT Package: Attachment 196094
The package is linked now instead of embedded so the ZIP archive is a lot smaller. Clear the reference, click Apply Changes, the open References again -> Available Packages Tab -> Select the WinRT package.
Also if you're interested check out this VB6 Thread for more WinRT sample projects.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Hi VanGoghGaming! it worked well.
Can the window rendered from XAML into the TwinBasic form create a transparent background overlay, similar to PowerToys' Fancy Zone?
I've read your articles on WinRT for VB6 and TwinBasic. Your WinRT library provides a modern UI experience for VB6 and TwinBasic. Thank you for your efforts.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
No, while XAML controls do have transparency, the XAML Island itself can't be used as an overlay over other windows.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Can the library you are developing use XAML code with the WinUI3 GUI from the Windows App SDK? WinUI3 has a modern interface and also reduces development time.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
No mate, this package is only for UWP controls that come built in with the operating system. WinUI3 requires the Windows App SDK and a new TypeLib encapsulating its IDL files as well as shipping additional DLLs with your app since they are not present in Windows by default.
-
1 Attachment(s)
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
I once experimented a bit with the Windows App SDK and VB6. Eventually, however, I abandoned the project partly because it turned out to be somewhat different from WinUI 2 (XAML Islands), and partly because VB6 crashed on me several times. Perhaps VanGoghGaming could take a look at it, that might eventually lead to a working solution. I had previously described the steps I took back then to obtain the .winmd files and extract the IDLs. However, I cannot upload everything here, as the resulting ZIP file would be too large. Therefore, the ZIP archive contains only the VB6 code, along with the Microsoft.WindowsAppRuntime.Bootstrap.dll for x86.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Yes, I installed the Windows App SDK (latest version seems to be 2.0) so I needed an updated Microsoft.WindowsAppRuntime.Bootstrap.dll and then your projects worked fine (after fixing the version numbers required for the MddBootstrapInitialize2 function) but this is really not the way to move forward.
You should forget about DispCallFunc and give twinBASIC a try. Like you said, the IDL files are easy to extract from the winmd files and then it's a piece of cake to rewrite the interfaces in twinBASIC syntax. Then it should be much easier to test these WinUI3 classes and see what works.
-
Re: twinBASIC - WinRT XAML Islands Demo or How to spruce up your User Interface
Quote:
Originally Posted by
VanGoghGaming
You should forget about DispCallFunc and give twinBASIC a try.
I know. But for that, my day would have to be at least 48 hours long. :D
The way version numbers are handled in conjunction with the Windows App SDK is also far from ideal. You are required to have that *exact* version installed so that your own program aligns correctly with the version number for MddBootstrapInitialize2. Consequently, or so I understand it, you might, under certain circumstances, need to have multiple versions of the Windows App SDK installed simultaneously.
My project (VBC_WinAppSDK_2) still crashes when AppWindowTitleBar is used for a VB6 window. I haven't investigated further to see if it also crashes when applied directly to a newly created AppWindow. I suspect, however, that I may have overlooked something regarding the DispatcherQueueController. If you comment out the DispatcherQueueController in "Sub Main", VB6 no longer crashes but then XAML does not work. Another thing I noticed is that you apparently no longer need a manifest for XAML to work with the Windows App SDK. Or do you?