xamarin/Xamarin.Forms

[UWP] Skipping setting "default values" for element properties in renderers is problematic

オープン

#4,312 opened on 2018/11/05

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)C# (1,926 件のフォーク)batch import
e/6 :clock6:help wantedinactivep/UWPt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

https://github.com/xamarin/Xamarin.Forms/blob/ee91ac443941133a9163c62787d831ad16aaa156/Xamarin.Forms.Platform.UAP/ButtonRenderer.cs#L58

Is checking of default values really necessary in renderers?:

If ... Element.Padding != Button.PaddingProperty.DefaultValue ... UpdatePadding();

The default padding value for a Xamarin button is (0,0,0,0), while the default padding for a UWP button is (8,4,8,4). (https://msdn.microsoft.com/en-us/library/windows/apps/mt299109.aspx)

This means that if I set padding (0,0,0,0) on a Xamarin button, and I really want it to be (0,0,0,0) on UWP, the renderer will skip setting the padding property. And my UWP button will have a (8,4,8,4) padding, which is not my intent!

Does checking and skipping default property values in renderers have any meaningful purpose? It seems to me that it creates more problems than it solves.

コントリビューターガイド