1

is any possibility to use Xamarin.Forms.Visual.Material NuGet package and set Text Fields style from Filled to Outlined without any custom renders for both platforms.

We already had it in Xamarin.Android only, but do we have it in Xamarin.Forms ???

Thanks

subKiller
  • 160
  • 3
  • 11

1 Answers1

0

Currently Xamarin.Forms.Visual.Materialpackage only supports Android and iOS .

The process for enabling Xamarin.Forms Material Visual in your application is:

  1. Add the Xamarin.Forms.Visual.Material NuGet package to your iOS and Android platform projects.(no need to install in Forms)

  2. Initialize Material Visual in each platform project.

    • Android: Add in MainActivity.cs

      global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
      global::Xamarin.Forms.FormsMaterial.Init(this, savedInstanceState);
      
    • iOS: Add in AppDelegate

      global::Xamarin.Forms.Forms.Init();
      global::Xamarin.Forms.FormsMaterial.Init();
      
  3. Create Material Visual controls by setting the Visual property to Material on any pages that should adopt the Material Design rules.


Refer to https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual/material-visual

ColeX
  • 14,062
  • 5
  • 43
  • 240
  • Thanks for your answer, but it will be `Filled` Style of Material in your example, I would like to achieve `Outlined` style and don't know(can't find) how to enable it – subKiller Aug 06 '20 at 18:56
  • Could you post the code how you achieve it in android ? Maybe you could implement this using custom renderer : https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual/material-visual#customize-material-visual. – ColeX Aug 07 '20 at 01:48
  • As a reference, you can check these links: https://stackoverflow.com/questions/61372298/how-to-implement-material-outlined-textfield-with-trailing-icon-in-xamarin-form https://stackoverflow.com/questions/62471816/outlined-material-entry-for-xamarin-forms-for-android-and-ios-both https://stackoverflow.com/questions/59132739/outlined-textbox-in-xamarin- forms/59279947#59279947 And now comes my question, co we have it without custom renderes, set by some flag, option or something like that – subKiller Aug 07 '20 at 10:22
  • 1
    No , the package don't provide exact api to change control's style , i think the only solution is custom renderer (all the link you provided used custom renderer). – ColeX Aug 10 '20 at 08:44