Forms9Patch: Simplify multi-device image management in your PCL Xamarin.Forms mobile apps



  • BuildCalcBuildCalc USMember ✭✭✭

    @TobiasSchulz.9796 -

    Looks like the root cause has something to do with Page.effectControlProvider not getting set on iOS (but is on Android). I've updated the sample project to illustrate this.

  • MichaelSattlerMichaelSattler USMember

    Sorry for taking so long to get back to you. I tried out the changes you posted yesterday, and now I can see the popups, even with my custom renderer.

  • JSparrowJSparrow USMember

    @Ben Askren: I do not have GitHub ac can I upload zip file here...

  • BuildCalcBuildCalc USMember ✭✭✭


    This is really good news - thanks for trying the code out! This means that, once Xamarin fixes the bug where PlatformEffects are not attaching to Page elements in iOS, I will be able to modify Forms9Patch so the extra steps you took won't be necessary. I'll keep the PageRendererExtensionOnElementChanged and PageRendererExtensionDispose extensions public so nothing will break.

  • BuildCalcBuildCalc USMember ✭✭✭

    @JSparrow -

    Please take two minutes to get yourself a free Github account. Really worth the trouble.

  • BuildCalcBuildCalc USMember ✭✭✭

    New Feature Announcement

    Forms9Patch now includes two new Features for its Label, MaterialButton, Segment, and ImageButtonState elements:
    - Text Formatting via HTML Markup
    - Easy, PCL, Custom Font Management

    The new HTML Markup Text Formatting ability gives you the following subset of HTML tags to in-line format your text.

    • <big> Big
    • <b> Bold
    • <del> Delete
    • <em> Emphesis
    • <font> Font. Attributes:
      • face: font family (supports native, "Monospace", "San-serif", "Serif", and Embedded Resource custom fonts)
      • size: font size (in "px", "em", and "%" units, HTML 1-7 unitless, HTML relative, and HTML named sizes )
      • color: font color (in rgb, rgba, hex, and HTML named colors)

    • <ins> Insert
    • <i> Italic
    • <pre> Prefomatted (Monospace font with white space preserved)
    • <s> Stikethrough
    • <small> Small
    • <strike> Strikethrough
    • <strong> Strong
    • <sub> Subscript
    • <sup> Superscript
    • <tt> Teletype
    • <u> Underline

    Additionally, it provides the following style attributes, which can be used with any tag (even those not shown above):

    • style: Style applied within tag limits. Parameters:
      • background-color: Background color. (in rgb, rgba, hex, and HTML named colors)
      • color: Font (foreground) color. (in rgb, rgba, hex, and HTML named colors)
      • font-family: Font family (supports native, "Monospace", "San-serif", "Serif", and Embedded Resource custom fonts)
      • font-size: font size (in "px", "em", and "%" units, HTML 1-7 unitless, HTML relative, and HTML named sizes )
      • font-weight: Set to bold to apply bold to the text.  Only bold is supported at this time and only on fonts there a bold subset is available.  It is recommended to use the <b> tag instead.
      • font-style: Set to italic to apply italics formatting to the text. Only italic is supported at this time and only on fonts where an italic subset is available.  It is recommended to use the <i> tag instead.

    The new Custom Font Management takes out all of the platform specific work Xamarin requires to use custom fonts. Just add your font as an Embedded Resource to your PCL project and, when you need it, refer to it by its Resource ID when setting the FontFamily property of a Forms9Patch element or, in HTML, a FontFamliy or Face attribute.

    In concert with 3rd party fonts, like Google's Material Icon font, this means Forms9Patch make it a lot easier to craft your buttons and labels.

    There are lots of examples in the demo app and you can learn a lot more by visiting the Forms9Patch home page at

    As an example, here some sample code for a number of labels:

    using Xamarin.Forms;
    namespace Forms9PatchDemo
        public class HtmlLabelPage : ContentPage
            public HtmlLabelPage ()
                Padding = new Thickness (5, 20, 5, 5);
                Content = new ScrollView {
                    Content = new StackLayout {
                        Children = {
                            new Label { Text = "Hello HtmlLabelPage" },
                            new Forms9Patch.Label { HtmlText =  "<b>\nEMBEDDED (resource) CUSTOM FONT:</b>"},
                            new Forms9Patch.Label { 
                                Text = "",
                                FontFamily = "Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf",
                            new Forms9Patch.Label { HtmlText =  "<b>\nSUPPORTED HTML TAGS:</b>" },
                            new Forms9Patch.Label { HtmlText =  "plain: no tags"},
                            new Forms9Patch.Label { HtmlText =  "&lt;b&gt;: <b>Bold</b> plain"},
                            new Forms9Patch.Label { 
                                HtmlText =  "&lt;Bold&gt;: <b>Bold</b> w/ serif italic serif base font",
                                FontFamily = "Serif",
                                FontAttributes = FontAttributes.Italic,
                                TextColor = Color.Blue,
                            new Forms9Patch.Label { HtmlText =  "&lt;strong&gt;: <strong>strong</strong> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;i&gt;: <i>Italic</i> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;em&gt;: <em>emphesis</em> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;b&gt;&lt;i&gt;: <b><i>Bold+Italic</i></b> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;sub&gt;: H<sub>2</sub>0 H₂0 plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;sup&gt;: 42<sup>2</sup> 42² plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;u&gt;: <u>underlined</u> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;ins&gt;: <ins>inserted</ins> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font color=&quot;blue&quot;&gt;: <font color=\"blue\">Blue</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font color=&quot;#FF0000&quot;&gt;: <font color=\"#FF0000\">Red</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font color=&quot;rgb(0,255,0)&quot;&gt;: <font color=\"rgb(0,255,0)\">Green</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;1&quot;&gt;: <font size=\"1\">size 1</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;2&quot;&gt;: <font size=\"2\">size 2</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;3&quot;&gt;: <font size=\"3\">size 3</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;4&quot;&gt;: <font size=\"4\">size 4</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;5&quot;&gt;: <font size=\"5\">size 5</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;6&quot;&gt;: <font size=\"6\">size 6</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font size=&quot;7&quot;&gt;: <font size=\"7\">size 7</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font face=&quot;Monospace&quot;&gt;: <font face=\"Monospace\">Monspace</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font face=&quot;Serif&quot;&gt;: <font face=\"Serif\">Serif</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font face=&quot;Sans-serif&quot;&gt;: <font face=\"Sans-serif\">Sans-serif</font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;font face=(resource)&gt;: <font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;pre&gt;: <pre>preformatted  text</pre> plain  \ttext"},
                            new Forms9Patch.Label { HtmlText =  "&lt;tt&gt;: <tt>teletype</tt> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;strike&gt;: <strike>strikethrough</strike> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;s&gt;: <s>strikethrough</s> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;del&gt;: <del>deleted text</del> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;big&gt;: <big>BIG text</big> plain"},
                            new Forms9Patch.Label { HtmlText =  "&lt;small&gt;: <small>SMALL text</small> plain"},
                            new Forms9Patch.Label { HtmlText =  "\n<b>SUPPORTTED HTML ATTRIBUTES:</b>"},
                            new Forms9Patch.Label { HtmlText =  "background-color: <div style=\"background-color:LightGrey\">LightGrey background</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "color: <div style=\"color:Sienna\">Sienna Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-family (resource): <div style=\"font-family:Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-size: <div style=\"font-size:50%\">50% Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-size: <div style=\"font-size:8.5px\">8.5px Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-size: <div style=\"font-size:100%\">100% Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-size: <div style=\"font-size:17px\">17px Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-size: <div style=\"font-size:200%\">200% Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-size: <div style=\"font-size:34px\">34px Text</div> plain"},
                            new Forms9Patch.Label { HtmlText =  "font-weight: <div style=\"font-weight:Bold;font-style:Italic\">Bold+Italic Text</div> plain"},

    And the resulting screen shots:

    Apple Android
    HtmlLabelApple1 HtmlLabelAndroid1
    HtmlLabelApple2 HtmlLabelAndroid2
    HtmlLabelApple3 HtmlLabelAndroid3
  • NealLeaNealLea USMember
    edited June 2016

    Hello @BuildCalc,

    I used your library in my project. Its really great library and thanks for that.

    But I have a small issue related to 9 patched images on iOS.

    I have a test projects created in Xamarin.Forms Apps. When, I build and run it on android, it works perfectly. But Same code I run on iOS, it don’t works. The image loads and shows properly, honour its CapInsets on Android, but on iOS the image loads but don’t honour its CapInsets.

    I use XAML for layout, and below is my sample XAML code.

    <?xml version="1.0" encoding="utf-8"?>
 <ContentPage xmlns="" xmlns:x="" 

 <StackLayout HorizontalOptions="Center" VerticalOptions="Center"> 
 <Label Text="Welcome to Xamarin Forms!" VerticalOptions="Center" HorizontalOptions="Center" TextColor="Black" /> 
 <Grid WidthRequest="530"> 
 <Forms9Patch:Image Source="{local:ImageMultiResource Test9Patch.Resources.button_login}" CapInsets="12,12,12,12" /> <!-- CapInsets="12,12,12,12" --> 

    Please remember that, this code works on Android but not on iOS. I just need what specific thing i need to do to solve this. I need your help.

  • BuildCalcBuildCalc USMember ✭✭✭

    @NealLea, Thanks for giving me a chance to help. I will take a look at this no later than Monday and see what can be done.

  • NealLeaNealLea USMember

    @BuildCalc, Thanks for your reply. I would like you to have a look into issue and let me know the solution. :)

  • BuildCalcBuildCalc USMember ✭✭✭

    @NealLea ,

    I'm working on at right now. I believe I've found the root cause. Should have an update this afternoon if all goes well.

  • BuildCalcBuildCalc USMember ✭✭✭

    @NealLea ,

    I believe I have the now fixed issue you found and have pushed an update ( to Nuget. I've added the "Unrequested size, CapsInset Test" XAML test to the demo app to illustrate this in action. Please take a moment to update your packages and let me know if this addresses the issue as it has manifested itself in your application.

    And thank you again for giving me a change to address this - and thank you for bringing it to my attention.

  • BuildCalcBuildCalc USMember ✭✭✭

    New Feature Announcement

    After three weeks of work, I've been able to enhance the Forms9Patch library's Label element to have 6 different modes of autofitting/autoscaling/autosizing. This works with plain and HTML formatted text and with Head, Mid and Tail ellipses truncation. Three of the modes are for when the Label's bounds are imposed (by HeightRequest, WidthRequest or it's content is smaller than its parent layout) and the other three are for when its width has been imposed but the height has not.

    By default, if you set its Lines property to zero, it will either scale the font to fit the bounds (Bounds imposed) or scale the height of the Label (Width imposed).

    imposed Bounds imposed Width
    imposed bounds, Lines=0 imposed width, Lines=0

    If the Lines property is non-zero and you set the Fit property to LabelFit.Width, it will shrink the font size down from FontSize its until its content width fits on Lines lines. The shrinking is limited to MinFontSize, at which point it will truncate.

    imposed Bounds imposed Width
    imposed bounds, Lines!=0, Fit=LabelFit.Width imposed width, Lines!=0, Fit=LabelFit.Width

    If the Lines property is non-zero and you set the Fit property to LabelFit.Lines, it will either scale the font to fit Lines lines in the imposed Height (Bounds imposed) or scale the Height to match Lines lines. If the text doesn't fit in Lines lines, it will truncate.

    imposed Bounds imposed Width
    imposed bounds, Lines!=0, Fit=LabelFit.Lines imposed width, Lines!=0, Fit=LabelFit.Lines

    You can try it out in the demo app, available at and learn a lot more about how to use it and what else it has at
    Now I back to working on the app that led me to work on Forms9Patch in the first place!

  • BuildCalcBuildCalc USMember ✭✭✭

    FYI: Just updated to This build includes:

    • Enhanced:
      • Built to Android API 15 (rather than API 16)
      • Added IsElliptical to layouts and MaterialButton to make outline and fill elliptical rather than rectangular.
    • Fixed:
      • Opacity property of Image is now supported.
      • HtmlText property values with HTML font-size attributes that have decimal values will gracefully fail to the truncated integer values. Root cause appears to be a Xamarin.iOS bug (
    • Changed:
      • StickyBehavior property of buttons has been renamed ToggleBehvior and (for MaterialSegmentedControl it has been changed to GroupToggleBehavior)
  • WojciechBoczarskiWojciechBoczarski USUniversity ✭✭
    edited September 2016

    Just a question. I'm using Forms9Patch to display images in my ViewList.ImageCell by using binding on ImageSource. However I cannot get it to work correctly.

    This is my class with setting properties for binding

        namespace MyApp
            public class Navigation
                public string Title { get; set; }
                public string Description { get; set; }
                public ImageSource Thumbnail { get; set; }
               NavigationList = new List<Navigation>
                    new Navigation { Title = "Evacuation", Description="Begin or manage an Evacuation", Thumbnail = Forms9Patch.ImageSource.FromMultiResource("MyApp.Resources.fireevac.png")},
                    new Navigation { Title = "Locations", Description="Manage employee locations", Thumbnail = Forms9Patch.ImageSource.FromMultiResource("MyApp.Resources.locations.jpg")},

    And this is my XAML

                ItemsSource="{Binding NavigationList}">
                    <ImageCell Text="{Binding Title}"
                               Detail="{Binding Description}"
                               ImageSource="{Binding Thumbnail}"

    What am I doing wrong?

  • BuildCalcBuildCalc USMember ✭✭✭

    @WojciechBoczarski - There is just a bit too much missing in your code sample for me to replicate the issue you are seeing. Could you make a sample project (you have most of what you would need in the above code) that replicates the issue and post it on GitHub or BitBucket? Doing so would allow me to help and allow others to benefit from our efforts as well.

  • tomnuentomnuen VNMember ✭✭

    Hi Ben,

    I found a small issue in the ModalPopup.

    var popup = new ModalPopup(); popup.Content = new StackLayout(); .... .... popup.BindingContext = new ViewModel();

    In the above code. When setting the BindingContext of the ModalPopup to ViewModel, the Content.BindingContext is set to the ModalPopup itself, not the ViewModel. This is the workaround that I came up with.

    var popup = new ModalPopup(); popup.Content = new StackLayout(); ..... ..... popup.Content.BindingContext = new ViewModel();

    I'm not sure if this is the correct behaviour

  • BuildCalcBuildCalc USMember ✭✭✭

    @tomnuen -

    It might be the correct behavior. I'm on the road through the weekend but I'll take a closer look when I return.

    • Ben
  • SJ-87SJ-87 USUniversity ✭✭

    @BuildCalc Can you please provide me some samples for Modal and Bubble Popups with Xaml code (for the controls and binding).


  • GupthaGuptha USMember ✭✭

    @BuildCalc @BenAskren
    I'm very new to Xamarin.Forms. In this below url I found a License key for Forms9Patch ("8HY9-P5V6-J9WA-B3G8-BA8E-ERSA-JRKV-XTHE-79K6-YPY2-YRWX-Y5CW-RA59") and it works only for the project named as "MyDemoApp".
    If I have other name for my project (for testing and understanding the Forms9Patch purpose only) is there any other trail license key for this. And also I didn't find any sample resources with Xaml.
    Could you please suggest me and please provide me some samples please.

  • Hi, Amazing control set. Specially the BubblePopup. You have at the moment BubblePopup bound either to VisualElement or null. We would like to use it with toolbarItems. It is displayed in regards to where the toolbar item is, which is currently not possible because the toolbar items does not inherit from VisualElement! Also It would be interesting if the position can somehow be specified, say for example I have a map in my page and user long presses somewhere, I know the location of the tap, I want to display the bubblePopup in that location with some action buttons..
    Is there a way somehow to achieve what we want!! Or implemented in near future? Please help

  • BuildCalcBuildCalc USMember ✭✭✭

    @SyedMoshiurMurshed, thanks for the feedback. I've looked into this and it would not be trivial. At the moment, I don't have the bandwidth to do this so I must apologize that it won't happen anytime soon.

  • BuildCalcBuildCalc USMember ✭✭✭
    edited February 16

    @Guptha, @SJ-87

    The demo app name and key make up the mechanism to allow beta testing.

    I'm about to step out on a limb here (so I invite anyone with a better understanding of Xamarin's XAML to correct me). Forms9Patch popups, by their nature, are not children of a page in the classical sense. This is because they need to cross page boundaries when presented over a MasterDetailPage.

    If anyone reading this is very knowledgeable about Xamarin XAML, I have a question: Is it possible to make a .xaml + .xaml.cs pair for a Xamarin.Forms Layout (instead of a Xamarin.Forms Page)?

  • BuildCalcBuildCalc USMember ✭✭✭

    Forms9Patch version released


    This version has LOTS of new features. Some of the most important changes are for performance. Specifically:

    • Forms9Patch.Label checks for and ignores redundant layout cycles
    • Forms9Patch layouts now have the bool IgnoreChildren property. Setting this property to true will cause the layout in question to ignore InvalidateMeasure or layout changes on its children. Why would you want this? Let's say you have a grid view and none of the rows and columns are GridUnitType.Auto. In other words, your grid cell sizes should never change in response to a change in a child element. Set IgnoreChildren to true and now you greatly reduced the number of measure/layout calls up and down the view hierarchy with (in this case) no ill effects. Please note: this is a "running with scissors" feature. Use with caution.
    • Added the Retain property to the popups. The purpose of this property is to keep a popup (and its content) on the view stack after the popup has been hidden. This means that the popup and its children will not need to be re-rendered (sometimes a painful process on Android) when it is presented again.

    more tags in HTML markup

    Another feature that has been requested a few times: support for the <a> tag in HtmlText properties. The demo app has an example of this in action. Just be sure to include an id and/or href attribute because <a> doesn't launch a browser window. Rather, it fires an ActionTagTapped event on your Forms9Patch.Label instance and passes id and href as strings.

    Also, I've added the <num> and <den> tag as slightly different versions of <sup> and <sub>.

    Convenience popups

    The Toast, TargetedToast, PermissionPopup and ActivityIndicatorPopup are all meant to make common tasks much easier.

    Support for using Icon Fonts in lieu of ImageSource

    The MaterialButton and MaterialSegmentedControl now support using HTML markup text as an alternative to ImageSource for the button's icon. The IconText property is for this purpose. See for an example.


    A bunch of extensions you night find useful:

    • static Color RgbBlend(this Color c, Color c2, double percent) usage: blend = c.RgbBlend(c2, percent) will return the color percent between c and c2.
    • static Color WithAlpha(this Color c, double alpha) usage: alphaColor = c.WithAlpha(c, alpha) will return a modified version of color c where the opacity has been set to alpha.
    • static bool CanPrint(this WebView webview) will return if you can print the contents of a Xamarin.Forms.WebView.
    • If CanPrint returns true, you can use static void Print(this WebView webview, string jobname) to print the contents of a Xamarin.Forms.WebView.
    • Use static Color ToColor(this string s) to take a HTML color string and turn it to a Xamarin.Forms.Color.
    • Want to create an image of some HTML? Pass a HTML string to static void ToPng(this string html, string fileName, Action<string> onComplete) and it will pass the path to a PNG image of the HTML to the onComplete action. See for an example.


    • Want to hide the on-screen keyboard? Call KeyboardService.Hide().
    • Want to be notified when the on-screen keyboard appears? Subscribe to the KeyboardService.Shown event.
    • Want to be notified when the on-screen keyboard disappears? Subscribe to the KeyboardService.Hidden event.
    • Want to make a system haptic feedback (sound/vibrate) to happen? Check out the HapticsService.Feedback method.

    ListView and SinglePicker

    These have actually been undocumented elements for quite a number of releases. However, I'm to the point where their interfaces have stabilized. Unfortunately, their Android performance still isn't good enough so I'm making them "alpha". If you're curious about them, let me know and I'll share more.


    There are a few more new features and tweaks. Check out to learn more.

  • BuildCalcBuildCalc USMember ✭✭✭

    If anyone reading this is very knowledgeable about Xamarin XAML, I have a question: Is it possible to make a .xaml + .xaml.cs pair for a Xamarin.Forms Layout (instead of a Xamarin.Forms Page)?

    I'm an idiot! Yes, Xamarin Studio makes this easy because "Forms ContentView XAML" is an option when you do a "File New...".

    @Guptha, @SJ-87,
    To further try to answer your question: You still can't specify a Forms9Patch popup via XAML (again, because it isn't a child of a page or view) but you can specify the Content of a Forms9Patch popup in XAML. Then, in your page or views code behind you can instantiate and present your popup.

  • BuildCalcBuildCalc USMember ✭✭✭

    Forms9Patch version 0.10.2 now available

    Now supports Shared Library Projects

    I got a question this morning: does Forms9Patch support Shared Library projects? I had no idea so I tried it. Sure enough, it (almost) does. Everything works except reading Embedded Resource font files (and that caused things to crash). After some work, I'm proud to say version 0.10.2 now supports Shared Library projects!

    And, if you're curious about how such a project is put together, your can check out the Shared Library Forms9Patch demo app.

  • GlenRutherfordGlenRutherford AUMember

    I am really interested in using your library. The first item I wanted to use is the ModalPopup but when I run it up on the iOS simulator I get this exception: System.MissingMemberException: FormsGestures: Failed to load IGestureService instance. It runs fine on the Android simulator and your demo app runs fine too! Not sure what I am doing wrong here, I have created a minimum reproducible project on BitBucket:

    Can you please help!

  • BuildCalcBuildCalc USMember ✭✭✭


    First, thanks for giving me a chance to help. You've stumbled upon the most common issue encountered by Forms9Patch users: Not initializing Forms9Patch. To fix it, you need to add the following to your Android project's MainActivity.cs immediately after global::Xamarin.Forms.Forms.Init(...).

    Forms9Patch.Droid.Settings.LicenseKey = "NZPK-RMP4-PJVV-Z7LP-78JF-GNXB-CDJZ-SRYA-BLR2-WBZC-G64K-QJZW-65DB";

    And, likewise, for your iOS project's AppDelegate.cs:

    Forms9Patch.iOS.Settings.LicenseKey = "NZPK-RMP4-PJVV-Z7LP-78JF-GNXB-CDJZ-SRYA-BLR2-WBZC-G64K-QJZW-65DB";

    Also, if you tripped over this problem, you'll very likely trip over other configuration issues as well. Please take a moment to go to and review the instructions on "How do I configure my app name?" and "Is there a trial version?".

  • GlenRutherfordGlenRutherford AUMember

    OK thanks for the advice. I thought that I would be immune to the trial restrictions as I'm not trying to use "HtmlText properties and the image manipulations". Anyway, I'll update my project and hopefully all will be good!

  • GlenRutherfordGlenRutherford AUMember

    I've decided to buy a license but my App name will probably change between now and release (depending on what the client eventually decides to call it). Can it be updated later or is it fixed from now until the end of time?

  • BuildCalcBuildCalc USMember ✭✭✭

    @GlenRutherford , rather than buying a license (and if possible for business reasons), I would recommend naming your app Forms9PatchDemo during your early development. This would allow you to use the Forms9Patch demo license key and try out all of the Forms9Patch functionality.

    With that being said, I should note that most of the Forms9Patch features do not require a valid key (no kidding!). Setting the key (to a valid or invalid value) is required to assure all the dependencies are linked (which is the problem you ran into earlier).

    Lastly, if you do purchase a key and realize it isn't for the needed app name, just email me and we'll work it out.

  • GlenRutherfordGlenRutherford AUMember

    Cool, thanks.

  • tomnuentomnuen VNMember ✭✭
    edited March 23

    On iPhone 7 Plus, the Display.Scale method returns 1 (supposed to be 3). Correct me if I'm wrong, it must call UIScreen.MainScreen.Scale behind the scene. There is a property called UIScreen.MainScreen.NativeScale which returns the correct device scale (3). You might want to update your implementation if that is the case.

  • BuildCalcBuildCalc USMember ✭✭✭

    @tomnuen - There may be a bug in play here but I have my doubts. I just ran the code on the emulator for the iPhone 7s Plus and, as it should, it returned 3 for Display.Scale. That being said, it will return the wrong value if you didn't call Forms9Patch.iOS.Settings.LicenseKey = "a_valid_or_invalid_license_key_here"; in your AppDelegate.cs file (right after global::Xamarin.Forms.Forms.Init(...).

  • tomnuentomnuen VNMember ✭✭

    @BuildCalc you're correct! I just gave Forms9Patch a try and didn't put in the license key.

    Thank you!

  • blendedcoffeeblendedcoffee USMember

    Hi @BuildCalc , need your help.. after getting a license the an error shows ..

    Position 6:16. Type ImageMultiResource not found in xmlns
    error : An item with the same key has already been added

  • BuildCalcBuildCalc USMember ✭✭✭
    edited April 12

    @blendedcoffee , without seeing a lot more information I can only take a guess. Can't say enough about how important it is to stop and make time to construct a good question.

    The biggest clue is Type ImageMultiResource not found in xmlns which, in english, means the ImageMultiResource IMarkupExtension is not visible to your XAML file. Why is that? My guess would be you're either missing either a xmlns:local= attribute in your XAML's root tag (that would give it visibility to the namespace & assembly that has the ImageMultiResource IMarkupExtension -or- you don't have the ImageMultiResource IMarkExtension in that namespace & assembly.

    Or, it could be something else. The error: An item with the same key has already been added doesn't help a lot and could be a sign that there's something else going on here.

    In other words, I've probably spent more time guessing than was spent constructing the question. If my guesses are not helpful, please try using Xamarin's bug writing guidelines as a template on how to ask for help.

  • renzskarenzska USMember ✭✭
    edited May 3

    With the latest version of Forms9Patch, I'm getting the following error in the FormsPreviewer for Android:

    "Specified cast is not valid" Forms9Patch.Droid.LabelRenderer.OnElementChanged, line: 0

    The iOS previewer works fine.

    I'm also getting instances where labels are not autosizing and being cutoff on Android:

        <Color x:Key="DebugBackgroundColor">Fuschia</Color>
        <Color x:Key="LightBackgroundColor">#E5E5EA</Color>
        <Color x:Key="AppBackgroundColor">#000000</Color>
        <Color x:Key="PrimaryColor">#99242F</Color>
        <Color x:Key="SecondaryColor">#414042</Color>
      <Style x:Key="MainButtonStyle" TargetType="Button">
            <Setter Property="TextColor" Value="{DynamicResource PrimaryColor}" />
            <Setter Property="FontSize" Value="Large" />
        <Style x:Key="MainLabelStyle" TargetType="f9p:Label">
            <Setter Property="TextColor" Value="{DynamicResource PrimaryColor}" />
            <Setter Property="HorizontalTextAlignment" Value="Center" />
            <Setter Property="Lines" Value="1" />
            <Setter Property="Fit" Value="Lines" />
            <!-- Fixes an issue on iPhone 7 Plus having the text wrap and cutoff on this style (it should be on one line and this fixes that -->
            <Setter Property="Margin" Value="1" />
        <Style x:Key="MainSubLabelStyle" TargetType="f9p:Label">
            <Setter Property="TextColor" Value="{DynamicResource SecondaryColor}" />
            <Setter Property="HorizontalTextAlignment" Value="Center" />
            <Setter Property="Lines" Value="1" />
            <Setter Property="Fit" Value="Lines" />
            <Setter Property="Margin" Value="1" />
    <f9p:Grid Grid.Row="2" Grid.Column="1" Padding="25" BackgroundColor="{DynamicResource LightBackgroundColor}" OutlineRadius="5" HasShadow="true">
                        <RowDefinition Height="8*" />
                        <RowDefinition Height="2*" />
                        <RowDefinition Height="*" />
                   <Image Grid.Row="0" Source="resources.png" />
                    <f9p:Label Grid.Row="1" Text="Existing Tips" Style="{StaticResource MainLabelStyle}" BackgroundColor="{StaticResource DebugBackgroundColor}" />
                    <f9p:Label Grid.Row="2" Text="Existing Tips" Style="{StaticResource MainSubLabelStyle}" />

    On Android:

    On iOS, it works if I set a Margin of 1 (shown in the style above).


  • BuildCalcBuildCalc USMember ✭✭✭

    @renzska --

    Can you send me a sample project that demonstrates what you're seeing? There are a lot of boundary conditions not covered in your sample code that may or may influence your results. A sample project would go a long way in helping me understand what you are seeing and why.

    -- Ben

  • renzskarenzska USMember ✭✭

    @BuildCalc, I'll put one together and post it soon. Thanks!

  • BuildCalcBuildCalc USMember ✭✭✭

    @renzska: Looking forward to it.

Sign In or Register to comment.