зеркало из https://github.com/DeGsoft/maui-linux.git
This commit is contained in:
Родитель
07ada19a7d
Коммит
68652b9f10
|
@ -0,0 +1,49 @@
|
|||
using System.Linq;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 5252, "iOS: The Editor and Entry placeholder default color should be the same", PlatformAffected.iOS)]
|
||||
|
||||
class Issue5252 : TestContentPage
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
var sl = new StackLayout();
|
||||
sl.Children.Add(new Label()
|
||||
{
|
||||
Text = "iOS: The Editor and Entry placeholder default color should be the same for consistency"
|
||||
});
|
||||
|
||||
var entry = new Entry()
|
||||
{
|
||||
Placeholder = "Entry placeholder",
|
||||
};
|
||||
sl.Children.Add(entry);
|
||||
|
||||
var editor = new Editor()
|
||||
{
|
||||
Placeholder = "Editor placeholder",
|
||||
};
|
||||
sl.Children.Add(editor);
|
||||
|
||||
sl.Children.Add(new Button()
|
||||
{
|
||||
Text = "Toggle placeholder color",
|
||||
Command = new Command(() =>
|
||||
{
|
||||
entry.PlaceholderColor = entry.PlaceholderColor.IsDefault ? Color.Red : (Color)Entry.PlaceholderColorProperty.DefaultValue;
|
||||
editor.PlaceholderColor = editor.PlaceholderColor.IsDefault ? Color.Red : (Color)Editor.PlaceholderColorProperty.DefaultValue;
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Content = new ScrollView()
|
||||
{
|
||||
Content = sl
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -430,6 +430,7 @@
|
|||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue4600.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue5252.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue5057.xaml.cs">
|
||||
<DependentUpon>Issue5057.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
|
|
|
@ -9,6 +9,9 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
{
|
||||
public class EditorRenderer : EditorRendererBase<UITextView>
|
||||
{
|
||||
// Using same placeholder color as for the Entry
|
||||
readonly UIColor _defaultPlaceholderColor = ColorExtensions.SeventyPercentGrey;
|
||||
|
||||
UILabel _placeholderLabel;
|
||||
|
||||
public EditorRenderer()
|
||||
|
@ -63,10 +66,11 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
protected internal override void UpdatePlaceholderColor()
|
||||
{
|
||||
if (Element.PlaceholderColor == Color.Default)
|
||||
_placeholderLabel.TextColor = UIColor.DarkGray;
|
||||
Color placeholderColor = Element.PlaceholderColor;
|
||||
if (placeholderColor.IsDefault)
|
||||
_placeholderLabel.TextColor = _defaultPlaceholderColor;
|
||||
else
|
||||
_placeholderLabel.TextColor = Element.PlaceholderColor.ToUIColor();
|
||||
_placeholderLabel.TextColor = placeholderColor.ToUIColor();
|
||||
}
|
||||
|
||||
void CreatePlaceholderLabel()
|
||||
|
|
Загрузка…
Ссылка в новой задаче