Add WPF, WinForms, Mac nodes to samples
See original GitHub issueFrom slack discussion with @charlesroddie and @mydogisbox
The pre-release of Xamarin.WPF is just out. It seems to be usable with glitches here or there as you would expect. It has all the stock controls in Xamarin.Forms. There is almost no support in 3rd party controls at the moment. (edited)
Let’s add a sample under https://github.com/fsprojects/Elmish.XamarinForms/tree/master/Samples/CounterApp
I’d like to also see WinForms and Mac nodes under there.
Here’s a sample from @mydogisbox:
type CounterApp () as app =
inherit Application ()
let program = Program.mkProgram App.init App.update App.view
let runner =
program
|> Program.withConsoleTrace
|> Program.withDynamicView app
|> Program.run
type MainWindow() as this =
inherit FormsApplicationPage()
do Forms.Init()
do this.LoadApplication(new CounterApp())
[<STAThread>]
[<EntryPoint>]
do (new System.Windows.Application()).Run(MainWindow()) |> ignore
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
Simple data app with WPF and Entity Framework 6
Right-click on the project node in Solution Explorer and choose Add > New Item. In the left pane, under the C# node, choose...
Read more >Embed WPF User Controls in WinForms Applications
In the Solution Explorer of the project, right-click on the project node and select Add->New Item. Select UserControl (WPF) and create your own ......
Read more >How to make WPF TreeView style as WinForms TreeView?
Let me answer my own question. WPF TreeView: Original Style WPF TreeView: WinForms Style. Code. All you need to do is a XAML...
Read more >Will Flutter or React Native overtake WPF and/or Winforms?
39 votes, 84 comments. I have been a hardcore .NET developer for about 5 years now, focusing on Windows App development using Winforms....
Read more >Revit WPF Add-Ins and Template
The only downside seems to be that many existing samples in the Revit SDK and elsewhere use WinForms. That said, the Revit IFC...
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
Thanks for the encouragement and instructions, @charlesroddie. After referencing sample Xamarin.UWP projects and figuring out that there was one missing step (changing the class of the
<Page>
element to<forms:WindowsPage>
), I was able to get something working, although it occasionally throws an exception on theXamarin.Forms.Forms.Init(e);
line, saying “More data is available.” It sounds like this is a Xamarin.UWP bug, probably a failure to loop and read all available data somewhere. I’ll track that down and perhaps file a report later, but it doesn’t seem to have anything to do with this project.So, basically, everything is set for UWP, too, at least for local testing. I’ll submit a PR shortly.
Please add that @bugQ . Getting this running is easy, except release to store which is in testing.
You can add a UWP project, min Windows version FCU. Put
xmlns:forms="using:Xamarin.Forms.Platform.UWP"
inside<Page>
tags inMainPage.xaml
. PutXamarin.Forms.Forms.Init(e);
after therootFrame
instructions inApp.xaml.cs
. Installing the relevant nuget packages. PutLoadApplication(new AppName.App());
afterthis.InitializeComponent();
inMainPage.xaml.cs
, after adding the appropriate project reference.You can also copy over from a C# Xamarin.Forms template if you prefer.
You can then run in debug mode, and test in release mode using the instructions in the thread you linked.
You’ll need to do this for each of the samples.