This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| public class DummyPanel : Canvas | |
| { | |
| ContentControl control; | |
| VisualElement element; | |
| public DummyPanel(VisualElement element) | |
| { | |
| this.element = element; | |
| DispatchAdd(); | |
| } | |
| void AddControl() | |
| { | |
| if (control != null) | |
| { | |
| Children.Remove(control); | |
| } | |
| Width = 200; | |
| Height = 200; | |
| control = new ContentControl(); | |
| control.Content = "UWPApplication"; | |
| SetLeft (control, 200); | |
| SetTop (control, 200); | |
| Children.Add(control); | |
| control.InvalidateMeasure(); | |
| control.InvalidateArrange(); | |
| ((IVisualElementController)this.element).NativeSizeChanged (); | |
| } | |
| internal IAsyncAction renderSeriesAction; | |
| void DispatchAdd() | |
| { | |
| if (renderSeriesAction == null) | |
| renderSeriesAction = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, AddControl); | |
| } | |
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| [assembly: ExportRenderer(typeof(Xamarin.Forms.Label), typeof(App2.UWP.LabelRenderer))] | |
| namespace App2.UWP | |
| { | |
| public class LabelRenderer : ViewRenderer<Xamarin.Forms.Label, DummyPanel> | |
| { | |
| DummyPanel panel; | |
| protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Label> e) | |
| { | |
| base.OnElementChanged(e); | |
| panel = new DummyPanel (e.NewElement); | |
| SetNativeControl(panel); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment