Preview: Xamarin.Forms for macOS



  • JeffLewisJeffLewis USMember ✭✭

    @rogihee said:
    @JeffLewis: I think there is some progress going on in the desktop-support branch, menu's (main menu bar and context menu's) seem to be have been implemented in Core and MacOS:

    Thank you for the pointer, Rogier. I've actually been writing in bits of AppKit code into my Forms app to handle catching keyboard events so I can at least get the shortcuts going.

    Additional info on the ListView problem, it seems that if I refresh the list - even with the exact same data, the problem goes away, which is odd. It suggests there's an initialisation problem in the ListView class.

  • RogerHardimanRogerHardiman GBMember ✭✭

    My Pull Request to fix the important MacOS bug in DisplayActionSheet has been merged into the XamarinForms source on GitHub (the one where it could not handle long lists). The order of the list is still in reverse order to iOS and Android but I can live with that for now.

    It is really handy having the full source to Xamarin Forms on GitHub along with a project to test the GUI. Would have been stuck without it.

  • alexporubayalexporubay UAMember

    Nice news!
    Android again pleases all its customers, a new Oreo came out so let's see a review of this miracle:
    I also suggest to recall not a long but very interesting history of this operating system:

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭

    After solving some problems I can compile at last. Unfortunately now I get an exception on startup.

    System.TypeLoadException: Could not resolve type with token 01000120 (from typeref, class/assembly System.Drawing.RectangleF, Xamarin.Mac, Version=, Culture=neutral, PublicKeyToken=84e04ff9cfb79065)
    at Xamarin.Forms.Platform.MacOS.VisualElementTracker.OnUpdateNativeControl (CoreAnimation.CALayer caLayer) [0x001f4] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at Xamarin.Forms.Platform.MacOS.VisualElementTracker.UpdateNativeControl () [0x00038] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.SetMainPage () [0x00000] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00041] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at GestureSample.MacOS.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00013] in /Users/Michael/Documents/dev/GestureSample_Git/GestureSample/GestureSample.MacOS/AppDelegate.cs:31

    I have the alpha channel in VS Mac (Version 7.2 Preview (7.2 build 634)), Xamarin.Mac and XF

    This is my first try in VS Mac. I usually work in VS for Windows. So I may miss something which is obvious for everybody else.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭

    I changed a ton of things, but I think the problem was a reference to System.Drawing in my Mac project. No idea where that came from. I didn't use System.Drawing.RectangleF or any other type from that dll myself.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭

    So up to the next problem.

    @DavidOrtinau , you wrote in your blog post that NuGet package authors must target xamarinmac20 in order to get installed to the mac project. How exactly do I do that?

    I wrote in my .nuspec:

    <file src="..\MR.Gestures.MacOS\bin\Release\MR.Gestures.MacOS.dll" target="lib\xamarinmac20" />
    <file src="..\MR.Gestures\bin\Release\MR.Gestures.dll" target="lib\xamarinmac20" />
    <file src="..\MR.Gestures\bin\Release\MR.Gestures.XML" target="lib\xamarinmac20" />

    I also tried lib\Xamarin.Mac like you used in your own Xamarin.Forms.nuspec. Both versions add the files to the .nupkg file in the respective folder, but when I try to install the package to the macOS project, only the reference to MR.Gestures.dll (the PCL project) is added, but not MR.Gestures.MacOS.dll. The file MR.Gestures.XML is also copied to the target folder.

    What else do I have to do for this .dll to be deployed to my macOS project?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭
    edited October 6

    Another problem that I have is with compiling only on the Mac.

    My MR.Gestures solution has a project for every platform - from Windows Phone 8 Silverlight up to macOS. But I can't compile the whole solution anymore. If I want to make a NuGet package, I have to compile the macOS project on the Mac, copy the dll over to Windows, then compile the rest and run NuGet.exe pack there.

    I do understand that you won't add tooling support for WinPhone 8 and Windows Runtime anymore to VS for Mac, but macOS and UWP (and all others) should be compilable on one platform.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭

    I may be doing something out of the ordinary here, but I used a NavigationPage and PushAsync to switch to another ContentPage. The content of the second page is not displayed. Just the header and Title are changed. Filed bug 60021.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭
    edited October 12

    The Mac has its 0/0 coordinates at the LOWER left corner. Everybody else on earth has 0/0 at the top left.

    This makes platform independent code using AbsoluteLayout, RelativeLayout, TranslationY or AnchorY impossible. As XF wants to be a cross platform framework, you should flip the coordinates.

    As I see it every view needs to return true from its IsFlipped property. That would mean that every renderer needs to override that property and every other views which will be shown too. I hope there's an easier way to do this. That would be quite some effort.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭

    Next one:

    I have a NavigationPage, push a TabbedPage and when I try to go back and close the TabbedPage, the app crashes with this exception:

    [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
    Object name: 'TabbedPageRenderer'.
    at Foundation.NSObject.get_SuperHandle () [0x00021] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/Foundation/NSObject2.cs:416
    at AppKit.NSViewController.get_View () [0x00030] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/build/mac/mobile/AppKit/NSViewController.g.cs:1147
    at Xamarin.Forms.Platform.MacOS.TabbedPageRenderer.get_NativeView () [0x00000] in :0
    at Xamarin.Forms.Platform.MacOS.Platform.DisposeRendererAndChildren (Xamarin.Forms.Platform.MacOS.IVisualElementRenderer rendererToRemove) [0x0002a] in :0
    at Xamarin.Forms.Platform.MacOS.NavigationPageRenderer+<>c__DisplayClass44_0.b__0 () [0x00000] in :0
    at Xamarin.Forms.Platform.MacOS.NSViewControllerExtensions+<>c__DisplayClass0_0`1[T].b__0 () [0x0001b] in :0
    at ObjCRuntime.Trampolines+SDAction.Invoke (System.IntPtr block) [0x0001b] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/build/mac/mobile/ObjCRuntime/Trampolines.g.cs:10623
    at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
    at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/AppKit/NSApplication.cs:100
    at GestureSample.MacOS.MainClass.Main (System.String[] args) [0x00017] in /Users/Michael/Documents/dev/GestureSample_VS/GestureSample/GestureSample.MacOS/Main.cs:11

  • pierreDurantpierreDurant USMember ✭✭

    Hello !

    First of all: thanks for porting Forms on Mac ! Great work.
    But for my app, I really need "ScrollTo" for my ListView... It seems that this is not implemented.
    Question: when di you plan to implement the "ScrollTo" ?



  • pierreDurantpierreDurant USMember ✭✭

    Another question: is there a device (like "iOS") that I can use in my XAML file with "OnPlatform" for MacOS in order to detect that I'm or not on this platform ? I didn't find it...


  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭

    I filed a couple of bugs:

    • 60510: [MacOS] Stepper wraps from Minimum to Maximum and vice versa
    • 60511: Slider.Minimum > 0 crashes
    • 60512: Slider: circle is not at the right position
    • 60513: [MacOS] TimePicker raises PropertyChanged before it changes Time
    • 60515: [MacOS] closing a TabbedPage crashes with an ObjectDisposedException
    • 60516: [MacOS] cannot focus an EntryCell

    I can only file 2 bugs within 16 minutes. If you want to protect from spam, then you should probably build less bugs in your software.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @MichaelRumpler thanks for filing them! I'd much rather be fielding bugs in this preview than once we remove that label and declare it stable!

  • JimBordenJimBorden USMember ✭✭

    What ever happened to that commit with the menus that you references before? Was it abandoned?

  • pierreDurantpierreDurant USMember ✭✭

    another problem: crash when using the message center.
    with IOS or android, no problem.
    on MacOS: the message is sent & received. The action is performed.
    But when back just after the message sending (MessagingCenter.Send...) => crash !
    I don't know if this problem has already been pointed, but it should be.


  • pierreDurantpierreDurant USMember ✭✭

    HI all
    I have a problem with forms for MacOS and the "Messaging Center" !
    I define some message in a page in order to be able to call some functions of this page from other page.
    MessagingCenter.Subscribe<SettingsPage>(this, "Nouveau", (sender) => { Nouveau(); });

    this works absolutely fine in my IOS & Android versions.
    But not with the MacOS version.

    • the message is sent : OK
    • the function linked to the message si well executed: OK
    • BUT just after (when the program must "go back" to the initial page): CRASH
      at "NSApplication.Main(args);" in the main class
      Here is the error message:
      Exception has been thrown by the target of an invocation."

    iOS there something more to do on MAcOS in order to use the "messaging Center" ?
    Or is it a problem in the "preview version" ?

    other thing: any idea when the "ScrollTo" for ListView will be implemented ?



Sign In or Register to comment.