Scaffold ScrollViewRenderer
This commit is contained in:
parent
f309cb9247
commit
95b76f3783
|
@ -16,23 +16,24 @@ using Xamarin.Forms;
|
|||
[assembly: ExportRenderer (typeof (Label), typeof (LabelRenderer))]
|
||||
[assembly: ExportRenderer (typeof (LinkLabel), typeof (LinkLabelRenderer))]
|
||||
[assembly: ExportRenderer (typeof (LinkView), typeof (LinkViewRenderer))]
|
||||
[assembly: ExportRenderer(typeof(Picker), typeof(PickerRenderer))]
|
||||
[assembly: ExportRenderer(typeof(ListView), typeof(ListViewRenderer))]
|
||||
[assembly: ExportRenderer (typeof (Picker), typeof (PickerRenderer))]
|
||||
[assembly: ExportRenderer (typeof (ListView), typeof (ListViewRenderer))]
|
||||
[assembly: ExportRenderer (typeof (ProgressBar), typeof (ProgressBarRenderer))]
|
||||
[assembly: ExportRenderer (typeof (ScrollView), typeof (ScrollViewRenderer))]
|
||||
[assembly: ExportRenderer (typeof (SearchBar), typeof (SearchBarRenderer))]
|
||||
[assembly: ExportRenderer(typeof(Slider), typeof(SliderRenderer))]
|
||||
[assembly: ExportRenderer (typeof (Slider), typeof (SliderRenderer))]
|
||||
[assembly: ExportRenderer (typeof (Switch), typeof (SwitchRenderer))]
|
||||
[assembly: ExportRenderer (typeof (TimePicker), typeof (TimePickerRenderer))]
|
||||
[assembly: ExportRenderer(typeof(WebView), typeof(WebViewRenderer))]
|
||||
[assembly: ExportRenderer (typeof (WebView), typeof (WebViewRenderer))]
|
||||
[assembly: ExportImageSourceHandler (typeof (FileImageSource), typeof (FileImageSourceHandler))]
|
||||
[assembly: ExportImageSourceHandler (typeof (StreamImageSource), typeof (StreamImagesourceHandler))]
|
||||
[assembly: ExportImageSourceHandler (typeof (UriImageSource), typeof (ImageLoaderSourceHandler))]
|
||||
[assembly: ExportCell(typeof(Cell), typeof(CellRenderer))]
|
||||
[assembly: ExportCell(typeof(EntryCell), typeof(EntryCellRenderer))]
|
||||
[assembly: ExportCell(typeof(ImageCell), typeof(ImageCellRenderer))]
|
||||
[assembly: ExportCell(typeof(SwitchCell), typeof(SwitchCellRenderer))]
|
||||
[assembly: ExportCell(typeof(TextCell), typeof(TextCellRenderer))]
|
||||
[assembly: ExportCell(typeof(ViewCell), typeof(ViewCellRenderer))]
|
||||
[assembly: ExportCell (typeof (Cell), typeof (CellRenderer))]
|
||||
[assembly: ExportCell (typeof (EntryCell), typeof (EntryCellRenderer))]
|
||||
[assembly: ExportCell (typeof (ImageCell), typeof (ImageCellRenderer))]
|
||||
[assembly: ExportCell (typeof (SwitchCell), typeof (SwitchCellRenderer))]
|
||||
[assembly: ExportCell (typeof (TextCell), typeof (TextCellRenderer))]
|
||||
[assembly: ExportCell (typeof (ViewCell), typeof (ViewCellRenderer))]
|
||||
namespace Ooui.Forms
|
||||
{
|
||||
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
|
@ -44,10 +45,10 @@ namespace Ooui.Forms
|
|||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class ExportCellAttribute : HandlerAttribute
|
||||
{
|
||||
public ExportCellAttribute(Type handler, Type target) : base(handler, target)
|
||||
public ExportCellAttribute (Type handler, Type target) : base (handler, target)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using Ooui.Forms.Extensions;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Ooui.Forms.Renderers
|
||||
{
|
||||
public class ScrollViewRenderer : ViewRenderer<ScrollView, Div>
|
||||
{
|
||||
protected override void OnElementChanged (ElementChangedEventArgs<ScrollView> e)
|
||||
{
|
||||
base.OnElementChanged (e);
|
||||
|
||||
this.Style.Overflow = "scroll";
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged (sender, e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,18 @@ namespace Samples
|
|||
row1.Children.Add (new Label { Text = longText, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.End });
|
||||
rows.Children.Add (row1);
|
||||
|
||||
var row0s = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Azure };
|
||||
row0s.Children.Add (new Label { Text = shortText, LineBreakMode = LineBreakMode.WordWrap, WidthRequest = 100 });
|
||||
row0s.Children.Add (new Label { Text = mediumText, LineBreakMode = LineBreakMode.WordWrap, WidthRequest = 100 });
|
||||
row0s.Children.Add (new Label { Text = longText, LineBreakMode = LineBreakMode.WordWrap, WidthRequest = 100 });
|
||||
rows.Children.Add (new ScrollView { Content = row0s });
|
||||
|
||||
var row1s = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.GhostWhite };
|
||||
row1s.Children.Add (new Label { Text = shortText, FontAttributes = FontAttributes.Bold, WidthRequest = 100, HorizontalOptions = LayoutOptions.Start });
|
||||
row1s.Children.Add (new Label { Text = mediumText, FontAttributes = FontAttributes.Bold, WidthRequest = 100, HorizontalOptions = LayoutOptions.FillAndExpand });
|
||||
row1s.Children.Add (new Label { Text = longText, FontAttributes = FontAttributes.Bold, WidthRequest = 100, HorizontalOptions = LayoutOptions.End });
|
||||
rows.Children.Add (new ScrollView { Content = row1s });
|
||||
|
||||
var row2 = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Azure };
|
||||
row2.Children.Add (new Entry { Text = shortText, FontSize = 8, VerticalOptions = LayoutOptions.Center });
|
||||
row2.Children.Add (new Entry { Text = shortText, FontSize = 16, VerticalOptions = LayoutOptions.Center });
|
||||
|
@ -49,7 +61,7 @@ namespace Samples
|
|||
row5.Children.Add (new Button { Text = shortText, FontSize = 32, VerticalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold });
|
||||
rows.Children.Add (row5);
|
||||
|
||||
var row6 = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.GhostWhite };
|
||||
var row6 = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Azure };
|
||||
row6.Children.Add (new DatePicker { VerticalOptions = LayoutOptions.Center });
|
||||
row6.Children.Add (new TimePicker { VerticalOptions = LayoutOptions.Center });
|
||||
rows.Children.Add (row6);
|
||||
|
|
Loading…
Reference in New Issue