maui-linux/Xamarin.Forms.Controls/CoreGalleryPages/EditorCoreGalleryPage.cs

55 строки
2.9 KiB
C#
Исходник Обычный вид История

2016-03-22 23:02:25 +03:00
using Xamarin.Forms.CustomAttributes;
namespace Xamarin.Forms.Controls
{
internal class EditorCoreGalleryPage : CoreGalleryPage<Editor>
{
protected override bool SupportsTapGestureRecognizer
{
get { return false; }
}
protected override void Build(StackLayout stackLayout)
2016-03-22 23:02:25 +03:00
{
base.Build(stackLayout);
2016-03-22 23:02:25 +03:00
var completedContainer = new EventViewContainer<Editor>(Test.Editor.Completed, new Editor());
completedContainer.View.Completed += (sender, args) => completedContainer.EventFired();
2016-03-22 23:02:25 +03:00
var textContainer = new ViewContainer<Editor>(Test.Editor.Text, new Editor { Text = "I have text" });
2016-03-22 23:02:25 +03:00
var textChangedContainer = new EventViewContainer<Editor>(Test.Editor.TextChanged, new Editor());
textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired();
var placeholderContainer = new ViewContainer<Editor>(Test.Editor.Placeholder, new Editor { Placeholder = "Placeholder" });
var textFontAttributesContainer = new ViewContainer<Editor>(Test.Editor.FontAttributes, new Editor { Text = "I have italic text", FontAttributes = FontAttributes.Italic });
var textFamilyContainer1 = new ViewContainer<Editor>(Test.Editor.FontFamily, new Editor { Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS" });
var textFamilyContainer2 = new ViewContainer<Editor>(Test.Editor.FontFamily, new Editor { Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold });
var textFontSizeContainer = new ViewContainer<Editor>(Test.Editor.FontSize, new Editor { Text = "I have default size text" });
var textFontSizeDefaultContainer = new ViewContainer<Editor>(Test.Editor.FontSize, new Editor { Text = "I also have default size text" });
textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize(NamedSize.Default, textFontSizeDefaultContainer.View);
var textFontSizeLargeContainer = new ViewContainer<Editor>(Test.Editor.FontSize, new Editor { Text = "I have size 48 (huge) text", FontSize = 48 });
2016-03-22 23:02:25 +03:00
var textColorContainer = new ViewContainer<Editor>(Test.Editor.TextColor,
2016-03-22 23:02:25 +03:00
new Editor { Text = "I should have red text", TextColor = Color.Red });
var textColorDisabledContainer = new ViewContainer<Editor>(Test.Editor.TextColor,
2016-03-22 23:02:25 +03:00
new Editor { Text = "I should have the default disabled text color", TextColor = Color.Red, IsEnabled = false });
var maxLengthContainer = new ViewContainer<Editor>(Test.Editor.MaxLength, new Editor { MaxLength = 3 });
Add(completedContainer);
Add(textContainer);
Add(textChangedContainer);
Add(placeholderContainer);
Add(textFontAttributesContainer);
Add(textFamilyContainer1);
Add(textFamilyContainer2);
Add(textFontSizeContainer);
Add(textFontSizeDefaultContainer);
Add(textFontSizeLargeContainer);
Add(textColorContainer);
Add(textColorDisabledContainer);
Add(maxLengthContainer);
2016-03-22 23:02:25 +03:00
}
}
}