Platform-Specifics
- PDF for offline use
- Sample Code:
- Related Articles:
- Related APIs:
Let us know how you feel about this
Translation Quality
0/250
last updated: 2017-04
Platform-specifics allow you to consume functionality that's only available on a specific platform, without implementing custom renderers or effects.
The following platform-specific functionality is built into Xamarin.Forms:
The process for consuming a platform-specific through XAML, or through a fluent code API is as follows:
- Add a
xmlnsdeclaration orusingdirective for theXamarin.Forms.PlatformConfigurationnamespace. - Add a
xmlnsdeclaration orusingdirective for the namespace that contains the platform-specific functionality:- On iOS, this is the
Xamarin.Forms.PlatformConfiguration.iOSSpecificnamespace. - On Android, this is the
Xamarin.Forms.PlatformConfiguration.AndroidSpecificnamespace. For Android AppCompat, this is theXamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompatnamespace. - On the Universal Windows Platform, this is the
Xamarin.Forms.PlatformConfiguration.WindowsSpecificnamespace.
- On iOS, this is the
- Apply the platform-specific from XAML, or from code with the
On<T>fluent API. The value ofTcan be theiOS,Android, orWindowstypes from theXamarin.Forms.PlatformConfigurationnamespace.
ℹ️Note that attempting to consume a platform-specific on a platform where it is unavailable will not result in an error. Instead, the code will execute without the platform-specific being applied.
Platform-specifics consumed through the On<T> fluent code API return IPlatformElementConfiguration objects. This allows multiple platform-specifics to be invoked on the same object with method cascading.
For more information about platform-specifics, see Consuming Platform-Specifics and Creating Platform-Specifics.
Let us know how you feel about this
Translation Quality
0/250
Xamarin Workbook
If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.

