diff options
author | WonYoung Choi <wy80.choi@samsung.com> | 2016-10-03 12:39:08 +0900 |
---|---|---|
committer | WonYoung Choi <wy80.choi@samsung.com> | 2016-10-03 12:42:27 +0900 |
commit | 41fb9760769acad716a178f124945ddc6f58f47d (patch) | |
tree | 370add8a49a1e7c0485f7701887f9cad2d9e2554 /Xamarin.Forms.ControlGallery.WindowsPhone | |
parent | efdb3beb6d5883d8c3b63ee03003c2220d6673d6 (diff) | |
download | xamarin-forms-41fb9760769acad716a178f124945ddc6f58f47d.tar.gz xamarin-forms-41fb9760769acad716a178f124945ddc6f58f47d.tar.bz2 xamarin-forms-41fb9760769acad716a178f124945ddc6f58f47d.zip |
Update to date Xamarin.Forms github
Change-Id: I20903831c8e128a79fe5bf34b3b805b6e1fe21e6
Diffstat (limited to 'Xamarin.Forms.ControlGallery.WindowsPhone')
3 files changed, 60 insertions, 12 deletions
diff --git a/Xamarin.Forms.ControlGallery.WindowsPhone/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.WindowsPhone/CustomRenderers.cs new file mode 100644 index 00000000..2f6cae90 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.WindowsPhone/CustomRenderers.cs @@ -0,0 +1,57 @@ +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Shapes; +using Xamarin.Forms.Platform.WinRT; + +[assembly: ExportRenderer(typeof(Xamarin.Forms.Controls.Bugzilla42602.TextBoxView), typeof(Xamarin.Forms.ControlGallery.WindowsPhone.TextBoxViewRenderer))] +namespace Xamarin.Forms.ControlGallery.WindowsPhone +{ + public class TextBoxViewRenderer : BoxViewRenderer + { + Canvas m_Canvas; + + protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e) + { + base.OnElementChanged(e); + + ArrangeNativeChildren = true; + + if (m_Canvas != null) + Children.Remove(m_Canvas); + + m_Canvas = new Canvas() + { + Width = 200, + Height = 200, + Background = new SolidColorBrush(global::Windows.UI.Color.FromArgb(0, 255, 255, 255)), + IsHitTestVisible = false + }; + + Children.Add(m_Canvas); + + //ellipse + Shape ellipse = new Ellipse() + { + Width = 100, + Height = 100, + Fill = new SolidColorBrush(global::Windows.UI.Color.FromArgb(255, 255, 0, 0)), + + }; + Canvas.SetLeft(ellipse, 0); + Canvas.SetTop(ellipse, 0); + m_Canvas.Children.Add(ellipse); + + //text + TextBlock text = new TextBlock() + { + FontSize = 50, + FontWeight = global::Windows.UI.Text.FontWeights.Normal, + Text = "hello world", + Foreground = new SolidColorBrush(global::Windows.UI.Color.FromArgb(255, 255, 0, 0)) + }; + Canvas.SetLeft(text, 0); + Canvas.SetTop(text, 150); + m_Canvas.Children.Add(text); + } + } +} diff --git a/Xamarin.Forms.ControlGallery.WindowsPhone/MainPage.xaml.cs b/Xamarin.Forms.ControlGallery.WindowsPhone/MainPage.xaml.cs index 1c34efd6..9a07cc50 100644 --- a/Xamarin.Forms.ControlGallery.WindowsPhone/MainPage.xaml.cs +++ b/Xamarin.Forms.ControlGallery.WindowsPhone/MainPage.xaml.cs @@ -23,18 +23,8 @@ namespace Xamarin.Forms.ControlGallery.WindowsPhone var app = new Controls.App (); - var mdp = app.MainPage as MasterDetailPage; - - var detail = mdp?.Detail as NavigationPage; - if (detail != null) { - detail.Pushed += (sender, args) => { - var nncgPage = args.Page as NestedNativeControlGalleryPage; - - if (nncgPage != null) { - AddNativeControls (nncgPage); - } - }; - } + // When the native control gallery loads up, it'll let us know so we can add the nested native controls + MessagingCenter.Subscribe<NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls); LoadApplication (app); } diff --git a/Xamarin.Forms.ControlGallery.WindowsPhone/Xamarin.Forms.ControlGallery.WindowsPhone.csproj b/Xamarin.Forms.ControlGallery.WindowsPhone/Xamarin.Forms.ControlGallery.WindowsPhone.csproj index a8565433..349b0b4c 100644 --- a/Xamarin.Forms.ControlGallery.WindowsPhone/Xamarin.Forms.ControlGallery.WindowsPhone.csproj +++ b/Xamarin.Forms.ControlGallery.WindowsPhone/Xamarin.Forms.ControlGallery.WindowsPhone.csproj @@ -117,6 +117,7 @@ <DependentUpon>App.xaml</DependentUpon> </Compile> <Compile Include="BrokenNativeControl.cs" /> + <Compile Include="CustomRenderers.cs" /> <Compile Include="MainPage.xaml.cs"> <DependentUpon>MainPage.xaml</DependentUpon> </Compile> |