Changes

HowTo:Convert Xamarin XAMLs to Maui

4,487 bytes added, 25 July
| ProgressBackground, ProgressColor
|}
 
[[Category:How-To|Convert Xamarin XAMLs to Maui]]
[[Category:MAUI|Convert Xamarin XAMLs to Maui]]
[[Category:XAML|Convert Xamarin XAMLs to Maui]]
== SfTabView ==
 
=== Namespace Update ===
'''Update Syncfusion TabView namespace.'''
Replace the Xamarin namespace with the MAUI equivalent.
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| clr-namespace:Syncfusion.XForms.TabView;assembly=Syncfusion.SfTabView.XForms
| clr-namespace:Syncfusion.Maui.Toolkit.TabView;assembly=Syncfusion.Maui.Toolkit
|}
 
=== Remove Obsolete Converters ===
'''Remove ItemCountToBoolConverter from Resources.'''
This converter is no longer usable in TabView headers.
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| <syntaxhighlight lang="xml"><converters:ItemCountToBoolConverter x:Key="ItemCountToBool" /></syntaxhighlight>
| [remove]
|}
 
=== Add StringFormatConverter ===
'''Use StringFormatConverter for combined header strings.'''
Syncfusion MAUI TabView uses a single `Header` property instead of templates.
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| [template-based header]
| <syntaxhighlight lang="xml"><converters:StringFormatConverter x:Key="ChildrenTabFormatter" Parameter1="{resources:Translate ChildrenTitle}" /></syntaxhighlight>
|}
 
⚠️ Avoid using bindings in `Parameter1` and `Parameter2` — use static strings only. For complex cases, use `EvalExpression`.
 
=== FontImageSource Styling ===
'''Add local style for FontImageSource.'''
Global styles are not supported.
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| [global FontImageSource style]
| <syntaxhighlight lang="xml">
<Style TargetType="FontImageSource">
<Setter Property="FontFamily" Value="{DynamicResource UBIKSymbols}" />
<Setter Property="Color" Value="{DynamicResource UBIKLightThemeColor}" />
</Style>
</syntaxhighlight>
|}
 
=== TabView Structure ===
'''Use Grid to wrap TabView.'''
MAUI TabView requires a different structure and property set.
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| <syntaxhighlight lang="xml">
<tabView:SfTabView VisibleHeaderCount="3">
...
</tabView:SfTabView>
</syntaxhighlight>
| <syntaxhighlight lang="xml">
<Grid>
<tabView:SfTabView>
<tabView:SfTabItem Header="string example header">
<tabView:SfTabItem.ImageSource>
<FontImageSource Glyph="{x:Static resources:UBIKIcons.XXX}" />
</tabView:SfTabItem.ImageSource>
<tabView:SfTabItem.Content>
<controls:UBIKContentView x:Name="ChildContainer" Converter="{StaticResource ChildAreaTemplateConverter}" />
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
</tabView:SfTabView>
</Grid>
</syntaxhighlight>
|}
 
=== Property Changes ===
'''Update renamed or removed properties.'''
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| VisibleHeaderCount
| [not available yet]
|-
| UBIKCenterButtonSettings
| CenterButtonSettings
|-
| SelectionIndicatorSettings
| IndicatorPlacement, IndicatorStrokeThickness, IndicatorBackground
|-
| SelectionColor
| Use VisualStateManager instead
|}
 
⚠️ Refer to [https://help.syncfusion.com/maui/tabview/migration Syncfusion migration guide] for full property list.
 
== OnPlatform + OnIdiom backup ==
 
=== Syntax Changes ===
'''Use inline or multi-tag syntax.'''
Single-tag syntax is outdated and may not build.
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| <syntaxhighlight lang="xml"><OnPlatform Android="False" iOS="True" /></syntaxhighlight>
| <syntaxhighlight lang="xml"><TheControl TheProperty="{OnPlatform Android=False, iOS=True}" /></syntaxhighlight>
|}
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| <syntaxhighlight lang="xml">
<OnPlatform x:TypeArguments="TheType">
<On Platform="Android" Value="False" />
<On Platform="iOS" Value="True" />
</OnPlatform>
</syntaxhighlight>
| Required for multi-tag syntax
|}
 
=== WinPhone to WinUI ===
'''Replace WinPhone with WinUI.'''
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| WinPhone
| WinUI
|}
 
=== GridLength and TypeArguments ===
'''Avoid x:TypeArguments with GridLength.'''
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| <syntaxhighlight lang="xml">
<ColumnDefinition.Width>
<OnIdiom x:TypeArguments="GridLength" Desktop="Auto" Phone="*" />
</ColumnDefinition.Width>
</syntaxhighlight>
| <syntaxhighlight lang="xml"><ColumnDefinition Width="{OnIdiom Desktop='Auto', Phone='*'}" /></syntaxhighlight>
|}
 
⚠️ Inline syntax is more reliable when using bindings or resources.
 
=== Special Characters ===
'''Wrap values in quotes if they contain commas or strings.'''
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| Margin={OnIdiom 10,2, Phone=2,0}
| Margin={OnIdiom '10,2', Phone='2,0'}
|}
 
=== UWP to WinUI ===
'''Replace UWP with WinUI in all OnPlatform scopes.'''
 
{| class="wikitable"
! Xamarin
! MAUI
|-
| UWP
| WinUI
|}
 
⚠️ For more details, refer to the [https://wiki.augmensys.com/index.php?title=XAML_Tips#Device_and_Platform_Responsiveness Wiki documentation].
[[Category:How-To|Convert Xamarin XAMLs to Maui]]
[[Category:MAUI|Convert Xamarin XAMLs to Maui]]
[[Category:XAML|Convert Xamarin XAMLs to Maui]]
1,765
edits