doc/articles/guides/xf-migration/control-mappings.md
This guide provides a comprehensive mapping of Xamarin.Forms controls and their equivalents in Uno Platform/WinUI. Understanding these mappings is essential when migrating your Xamarin.Forms application to Uno Platform.
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
StackLayout | StackPanel | Set Orientation property for horizontal/vertical layout |
Grid | Grid | Same control name, similar API with RowDefinitions and ColumnDefinitions |
AbsoluteLayout | Canvas | Use Canvas.Left, Canvas.Top for positioning |
RelativeLayout | RelativePanel | Different API - uses attached properties for relationships |
FlexLayout | Custom implementation or VariableSizedWrapGrid | No direct equivalent; consider redesigning with Grid or StackPanel |
ScrollView | ScrollViewer | Similar functionality with additional properties |
ContentView | ContentControl | Base class for custom controls |
Frame | Border | Use CornerRadius, BorderBrush, BorderThickness |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
Label | TextBlock | For read-only text display |
Entry | TextBox | Single-line text input |
Editor | TextBox with AcceptsReturn="True" | Multi-line text input |
SearchBar | AutoSuggestBox | Provides search functionality with suggestions |
Span (in FormattedString) | Run (in TextBlock) | For inline formatted text |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
Button | Button | Same control name |
ImageButton | Button with Image content | Or use AppBarButton with icon |
CheckBox | CheckBox | Same control name |
Switch | ToggleSwitch | Different control with on/off states |
Slider | Slider | Same control name |
Stepper | NumberBox | Provides increment/decrement functionality |
DatePicker | DatePicker or CalendarDatePicker | Choose based on UI requirements |
TimePicker | TimePicker | Same control name |
Picker | ComboBox | Dropdown selection control |
RadioButton | RadioButton | Available in WinUI 2.5+ |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
ListView | ListView | Same control name with different templating |
CollectionView | ItemsRepeater or ListView | ItemsRepeater for flexible layouts |
CarouselView | FlipView | Swipeable item view |
TableView | Custom with ListView or ItemsRepeater | No direct equivalent |
RefreshView | RefreshContainer | Pull-to-refresh functionality |
SwipeView | Custom implementation | Use SwipeControl on supported platforms |
IndicatorView | Custom implementation | Create with ItemsRepeater or dots pattern |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
Image | Image | Same control name |
ImageButton | Button with Image | Or use icon fonts |
BoxView | Rectangle or Border | For colored rectangles |
WebView | WebView2 | Requires WebView2 runtime on Windows |
MediaElement | MediaPlayerElement | For audio/video playback |
Map | Third-party map controls | Use Uno.Extensions or platform-specific maps |
ActivityIndicator | ProgressRing | Indeterminate progress indicator |
ProgressBar | ProgressBar | Same control name |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
ContentPage | Page | Base page type |
NavigationPage | Frame with navigation | See Migrating Navigation |
TabbedPage | NavigationView or TabView | Bottom tabs or top tabs |
CarouselPage | FlipView | Swipeable pages |
MasterDetailPage | NavigationView | Split view with menu |
Shell | NavigationView with routing | See navigation guide |
FlyoutPage | NavigationView | Replaces MasterDetailPage |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
ToolbarItem | AppBarButton in CommandBar | Top app bar buttons |
MenuItem | MenuFlyoutItem | Context menu items |
ContextActions | MenuFlyout or SwipeBehavior | Right-click or swipe actions |
Shapes (Rectangle, Ellipse, etc.) | Windows.UI.Xaml.Shapes namespace | Same shape controls |
| Xamarin.Forms | Uno Platform / WinUI |
|---|---|
HeightRequest | Height |
WidthRequest | Width |
MinimumHeightRequest | MinHeight |
MinimumWidthRequest | MinWidth |
HorizontalOptions | HorizontalAlignment |
VerticalOptions | VerticalAlignment |
Margin | Margin (same) |
Padding | Padding (same) |
| Xamarin.Forms | Uno Platform / WinUI |
|---|---|
Start | Left |
End | Right |
Center | Center |
Fill | Stretch |
| Xamarin.Forms | Uno Platform / WinUI |
|---|---|
BackgroundColor | Background (use SolidColorBrush) |
TextColor | Foreground (use SolidColorBrush) |
BorderColor | BorderBrush (use SolidColorBrush) |
Color.Accent | {ThemeResource SystemAccentColor} |
Color.Default | Theme-dependent resources |
| Xamarin.Forms | Uno Platform / WinUI |
|---|---|
FontSize | FontSize (same) |
FontAttributes="Bold" | FontWeight="Bold" |
FontAttributes="Italic" | FontStyle="Italic" |
FontFamily | FontFamily (same) |
TextTransform | Custom converter or CharacterCasing |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
Behavior<T> | Attached properties or Microsoft.Xaml.Behaviors | Use Uno.Toolkit or create custom attached properties |
TriggerAction | Visual states or code-behind | See Effects guide |
DataTrigger | Visual states with StateTrigger | Use AdaptiveTrigger, StateTrigger |
EventTrigger | Event handlers or behaviors | Use code-behind or behaviors library |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
DependencyService | Built-in DI (IServiceProvider) | Use constructor injection with IHost |
MessagingCenter | Event aggregator or messenger pattern | Use Uno.Extensions messaging or CommunityToolkit.Mvvm Messenger |
| Xamarin.Forms | Uno Platform / WinUI | Notes |
|---|---|---|
Application.OnStart | App.OnLaunched | Application startup |
Application.OnSleep | Application.EnteredBackground | App backgrounded |
Application.OnResume | Application.LeavingBackground | App foregrounded |
Application.MainPage | Window.Content or navigation setup | Set root content |
Some Xamarin.Forms features don't have direct equivalents and require alternative approaches:
ItemsPanel with different panel templates in ListView or ItemsRepeaterIncrementalLoadingTrigger or scroll position monitoringSwipeControl for Windows 10+Uno.Extensions.Navigation for similar URI-based routingFrame and view models for simpler scenariosNavigationView for hierarchical navigationGrid with responsive triggersVariableSizedWrapGrid for simple wrapping scenariosWhen migrating controls:
WebView2 becomes an HTML iframeListView and ItemsRepeater are optimized for large listsItemsStackPanel or ItemsWrapGrid for layout panels