// IComponentConnector public void Connect(int connectionId, global::System.Object target) { switch (connectionId) { case 2: // MainWindow.xaml line 54 this.obj2 = target.As <Microsoft.UI.Xaml.Controls.Grid>(); break; case 3: // MainWindow.xaml line 66 this.obj3 = target.As <Microsoft.UI.Xaml.Controls.TextBox>(); this.bindingsTracking.RegisterTwoWayListener_3(this.obj3); break; case 4: // MainWindow.xaml line 71 this.obj4 = target.As <Microsoft.UI.Xaml.Controls.DatePicker>(); this.bindingsTracking.RegisterTwoWayListener_4(this.obj4); break; case 5: // MainWindow.xaml line 77 this.obj5 = target.As <Microsoft.UI.Xaml.Controls.ComboBox>(); this.bindingsTracking.RegisterTwoWayListener_5(this.obj5); break; case 6: // MainWindow.xaml line 87 this.obj6 = target.As <Microsoft.UI.Xaml.Controls.CheckBox>(); this.bindingsTracking.RegisterTwoWayListener_6(this.obj6); break; case 7: // MainWindow.xaml line 93 this.obj7 = target.As <Microsoft.UI.Xaml.Controls.Button>(); this.obj7Click = (global::System.Object p0, global::Microsoft.UI.Xaml.RoutedEventArgs p1) => { this.dataRoot.viewModel.SelectedEmployee.Save(); }; (target.As <Microsoft.UI.Xaml.Controls.Button>()).Click += obj7Click; break; case 8: // MainWindow.xaml line 45 this.obj8 = target.As <Microsoft.UI.Xaml.Controls.Button>(); this.obj8Click = (global::System.Object p0, global::Microsoft.UI.Xaml.RoutedEventArgs p1) => { this.dataRoot.viewModel.Load(); }; (target.As <Microsoft.UI.Xaml.Controls.Button>()).Click += obj8Click; break; case 9: // MainWindow.xaml line 47 this.obj9 = target.As <Microsoft.UI.Xaml.Controls.ListView>(); this.bindingsTracking.RegisterTwoWayListener_9(this.obj9); break; default: break; } }
static void AddNativeBindings(NativeBindingGalleryPage page) { if (page.NativeControlsAdded) { return; } StackLayout sl = page.Layout; var txbLabel = new TextBlock { FontSize = 14, FontFamily = new FontFamily("HelveticaNeue") }; var txbBox = new TextBox { FontSize = 14, FontFamily = new FontFamily("HelveticaNeue") }; var btnColor = new global::Microsoft.UI.Xaml.Controls.Button { Content = "Toggle Label Color", Height = 80 }; btnColor.Click += (sender, args) => txbLabel.Foreground = SolidColorBrush.Pink.ToBrush(); var btnTextBox = new global::Microsoft.UI.Xaml.Controls.Button { Content = "Change text textbox", Height = 80 }; btnTextBox.Click += (sender, args) => txbBox.Text = "Hello 2 way native"; txbLabel.SetBinding("Text", new Binding("NativeLabel")); txbBox.SetBinding("Text", new Binding("NativeLabel", BindingMode.TwoWay), "TextChanged"); txbLabel.SetBinding("Foreground", new Binding("NativeLabelColor", BindingMode.TwoWay, new ColorToBrushNativeBindingConverter())); var grd = new StackPanel(); grd.Children.Add(txbLabel); grd.Children.Add(btnColor); sl?.Children.Add(grd.ToView()); sl?.Children.Add(txbBox); sl?.Children.Add(btnTextBox.ToView()); page.NativeControlsAdded = true; }