Scaffold ScrollViewRenderer
This commit is contained in:
parent
f309cb9247
commit
95b76f3783
|
@ -19,6 +19,7 @@ using Xamarin.Forms;
|
||||||
[assembly: ExportRenderer (typeof (Picker), typeof (PickerRenderer))]
|
[assembly: ExportRenderer (typeof (Picker), typeof (PickerRenderer))]
|
||||||
[assembly: ExportRenderer (typeof (ListView), typeof (ListViewRenderer))]
|
[assembly: ExportRenderer (typeof (ListView), typeof (ListViewRenderer))]
|
||||||
[assembly: ExportRenderer (typeof (ProgressBar), typeof (ProgressBarRenderer))]
|
[assembly: ExportRenderer (typeof (ProgressBar), typeof (ProgressBarRenderer))]
|
||||||
|
[assembly: ExportRenderer (typeof (ScrollView), typeof (ScrollViewRenderer))]
|
||||||
[assembly: ExportRenderer (typeof (SearchBar), typeof (SearchBarRenderer))]
|
[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 (Switch), typeof (SwitchRenderer))]
|
||||||
|
|
|
@ -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 });
|
row1.Children.Add (new Label { Text = longText, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.End });
|
||||||
rows.Children.Add (row1);
|
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 };
|
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 = 8, VerticalOptions = LayoutOptions.Center });
|
||||||
row2.Children.Add (new Entry { Text = shortText, FontSize = 16, 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 });
|
row5.Children.Add (new Button { Text = shortText, FontSize = 32, VerticalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold });
|
||||||
rows.Children.Add (row5);
|
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 DatePicker { VerticalOptions = LayoutOptions.Center });
|
||||||
row6.Children.Add (new TimePicker { VerticalOptions = LayoutOptions.Center });
|
row6.Children.Add (new TimePicker { VerticalOptions = LayoutOptions.Center });
|
||||||
rows.Children.Add (row6);
|
rows.Children.Add (row6);
|
||||||
|
|
Loading…
Reference in New Issue