FsXaml 2.0 Beta
See original GitHub issuePlease consider testing out the new prerelease of FsXaml 2.0, and leaving comments and ideas below.
NuGet package published at https://www.nuget.org/packages/FsXaml.Wpf/2.0.0-beta1
This release includes significant improvements to the generated code related to all XAML types. The containers and factories no longer exist - loading XAML files into a generated type is much more aligned with the results from C# code generation (with some differences, described below).
Major Changes
UserControl
types no longer are wrapped within aContentControl
when loaded from XAML. The “root” of the visual tree is the control itself, which means better efficiency, but also eliminates some of the bugs present in the previous version of FsXaml.Application
andResourceDictionary
no longer use factories. TheXAML<>
provider creates the Application or Resource Dictionary subclass directly. This is a breaking change from previous version - for example, instead ofApp().Root.Run()
you just doApp().Run()
.- The
IViewController
and specific view controller classes have been removed. TheViewController
types in previous versions were intended as a way to duplicate “code behind” style functionality. Since we now create types directly, and have flagged them as inheritable, you can write code behind directly in a subclass. Detailed examples exists in the demos. For an example, see: https://github.com/fsprojects/FsXaml/blob/master/demos/WpfSimpleMvvmApplication/MainView.xaml.fs#L5-L18 FrameworkElement
types automatically load all named elements. The 2nd static parameter to the type provider has been removed, and is automatically treated as if it weretrue
. Types without named elements do not create the accessors or incur extra overhead, as the type provider handles the checking internally.ResourceDictionary
types (andApplication
) no longer create elements for items byx:Key
. You can create a resource dictionary, but need to access it as a dictionary (which is more aligned with C#).- Added
Wpf
module with utilites which allow for installation of synchronization context prior to creating the application. This is required if doing asynchronous work within types that are generated directly from the main windows
Breaking Changes
- The factory type removal means removing the extra
.Root
from application and resource dictionaries. - ViewControllers no longer exist. Convert to using code behind directly.
Known Issues
- Use of code behind from within the main, startup window does not work. The easy workaround is to create the main window in code, such as in this demo: https://github.com/fsprojects/FsXaml/blob/master/demos/WpfMvvmAgent/App.fs#L9-L10
- Visual F# Power Tools will report erroneous errors when subclassing generated types from a type provider. Every use of code behind causes 3 errors to show up if Power Tools is enabled. (The compiler handles it fine, and doesn’t report errors, but if power tools is enabled, you get 3 that show up after compile, and red squigglies in the editor.)
Tasks prior to 2.0 RTM
- Report issue with Visual F# Power Tools and inherting from generated types
- See what can be done about #24
- Handle issue #34
-
Migrate supplied behaviors to attached propertiesMoved to future in #35 - Remove dependency of Expression.Blend.Sdk
- Optional: Ship behaviors as separate NuGet/Project? (Please comment on whether Blend support is important to you - or this may be dropped)
Please try the new package, and let me know of any issues, ideas, or improvements that need to happen prior to 2.0.
Thank you! Reed
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
FsXaml.Wpf 2.0.0-beta1
This is a prerelease of the FsXaml WPF project, version 2.0. It includes the XAML type provider for WPF, as well as EventToMailbox, ......
Read more >FsXaml
The library is available under the Apache 2.0 license, which allows modification and redistribution for both commercial and non-commercial purposes.
Read more >Blog articles - FPish
NET Standard 2.1 & New Fable 2.0 Beta ... fslexyacc × 1; fsxaml × 1; functional data structures × 1; functional-first × 1;...
Read more >.NET Core 2.0 and .NET Standard 2.0 planned for Spring ...
The SignalR is a beta right? The official resources only list SignalR 2 and the full framework as a platform. EF Core currently...
Read more >F# Weekly #20, 2016 – Sergey Tihon's Blog
New command in Paket 3 beta: "generate-include-scripts" allows you to create .fsx loads scripts ... Forge 1.0.0-alpha002 · FAKE 4.26.0 · FsXaml 2.0...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@brianberns Just realized - you can actually fix it now if you want. The pull request generates a new vsix. If you want to fix it immediately, you can install the vsix from VFPT at https://ci.appveyor.com/project/dungpa/visualfsharppowertools/build/2.5.0-a1605170311/artifacts
Yep, that’s exactly what I’m seeing. Thank you.