protected override void OnElementChanged(ElementChangedEventArgs <CustomRadioButton> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.CheckedChanged -= CheckedChanged; } if (this.Control == null) { var checkBox = new NativeCheckBox(); checkBox.Checked += (s, args) => this.Element.Checked = true; checkBox.Unchecked += (s, args) => this.Element.Checked = false; this.SetNativeControl(checkBox); } this.Control.Content = e.NewElement.Text; this.Control.IsChecked = e.NewElement.Checked; this.Element.CheckedChanged += CheckedChanged; this.Element.PropertyChanged += ElementOnPropertyChanged; }
protected override void OnElementChanged(ElementChangedEventArgs <CheckBox> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.CheckedChanged -= CheckedChanged; } if (this.Control == null) { var checkBox = new NativeCheckBox(); checkBox.Checked += (s, args) => this.Element.Checked = true; checkBox.Unchecked += (s, args) => this.Element.Checked = false; this.SetNativeControl(checkBox); } this.Control.Content = e.NewElement.Text; this.Control.IsChecked = e.NewElement.Checked; this.Control.Foreground = e.NewElement.TextColor.ToBrush(); UpdateFont(); this.Element.CheckedChanged += CheckedChanged; this.Element.PropertyChanged += ElementOnPropertyChanged; }
protected override void OnElementChanged(ElementChangedEventArgs <CheckBox> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.PropertyChanged -= ElementOnPropertyChanged; } if (Control == null) { var checkBox = new NativeCheckBox(Context); checkBox.CheckedChange += checkBox_CheckedChange; SetNativeControl(checkBox); } Control.Text = e.NewElement.Text; Control.Checked = e.NewElement.Checked; Control.SetTextColor(e.NewElement.TextColor.ToAndroid()); if (e.NewElement.FontSize > 0) { Control.TextSize = (float)e.NewElement.FontSize; } if (!string.IsNullOrEmpty(e.NewElement.FontName)) { Control.Typeface = TrySetFont(e.NewElement.FontName); } Element.CheckedChanged += CheckedChanged; Element.PropertyChanged += ElementOnPropertyChanged; }
protected override void OnElementChanged(ElementChangedEventArgs <CheckBox> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.PropertyChanged -= ElementOnPropertyChanged; } if (this.Control == null) { var checkBox = new NativeCheckBox(this.Context); checkBox.CheckedChange += checkBox_CheckedChange; this.SetNativeControl(checkBox); } this.Control.Text = e.NewElement.Text; this.Control.Checked = e.NewElement.Checked; this.Control.SetTextColor(e.NewElement.TextColor.ToAndroid()); this.Element.PropertyChanged += ElementOnPropertyChanged; }
protected override void InitControls() { this.Text = "Configuration Editor"; this.Width = 480; this.Height = 430; this.IconFile = "App.ico"; this.StartUpPosition = WindowsStartupPosition.CenterScreen; int top = 10; int leftLeft = 10; int rightLeft = 120; this._ChkContextMenu = new NativeCheckBox { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Context-Menu", }; this._ChkContextMenu.Style |= WindowStylesConst.WS_TABSTOP; this._ChkDevTools = new NativeCheckBox { Location = new Point(rightLeft, top), Width = 100, Height = 20, Text = "Dev-Tools" }; this._ChkStatusBar = new NativeCheckBox { Location = new Point(rightLeft + 110, top), Width = 100, Height = 20, Text = "Statusbar" }; this._ChkAppStatusBar = new NativeCheckBox { Location = new Point(this._ChkStatusBar.Left + this._ChkStatusBar.Width + 10, top), Width = 100, Height = 20, Text = "App-Statusbar" }; top += 30; NativeLabel lblTitle = new NativeLabel { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Title:", BackColor = this.BackColor }; this._TxtTitle = new NativeTextBox { Location = new Point(rightLeft, top), Width = 300, Height = 20, }; this._TxtTitle.Style |= WindowStylesConst.WS_BORDER; top += 30; NativeLabel lblUrl = new NativeLabel { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Url:", BackColor = this.BackColor }; this._TxtUrl = new NativeTextBox { Location = new Point(rightLeft, top), Width = 300, Height = 20 }; this._TxtUrl.Style |= WindowStylesConst.WS_BORDER; top += 30; NativeLabel lblUserFolder = new NativeLabel { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Data-Folder:", BackColor = this.BackColor }; this._TxtUserDataFolder = new NativeTextBox { Location = new Point(rightLeft, top), Width = 300, Height = 20 }; this._TxtUserDataFolder.Style |= WindowStylesConst.WS_BORDER; this._BnSelectUserDataFolder = new NativeButton { Location = new Point(rightLeft + 301, top), Width = 25, Height = 20, Text = "…" }; this._BnSelectUserDataFolder.Clicked += BnSelectUserDataFolder_Clicked; top += 30; NativeLabel lblBrowserExecutable = new NativeLabel { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Browser-Folder:", BackColor = this.BackColor }; this._TxtBrowserExecutable = new NativeTextBox { Location = new Point(rightLeft, top), Width = 300, Height = 20 }; this._TxtBrowserExecutable.Style |= WindowStylesConst.WS_BORDER; this._BnSelectBrowserExecutable = new NativeButton { Location = new Point(rightLeft + 301, top), Width = 25, Height = 20, Text = "…" }; this._BnSelectBrowserExecutable.Clicked += BnSelectBrowserExecutable_Clicked; top += 30; this._ChkMonitoring = new NativeCheckBox { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Monitoring" }; top += 30; NativeLabel lblMonitoriingUrl = new NativeLabel { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Monitoring-Url:", BackColor = this.BackColor }; this._TxtMonitoringUlr = new NativeTextBox { Location = new Point(rightLeft, top), Width = 300, Height = 20 }; this._TxtMonitoringUlr.Style |= WindowStylesConst.WS_BORDER; top += 30; NativeLabel lblMonitoriingPath = new NativeLabel { Location = new Point(leftLeft, top), Width = 100, Height = 20, Text = "Monitoring-Path:", BackColor = this.BackColor }; this._TxtMonitoringPath = new NativeTextBox { Location = new Point(rightLeft, top), Width = 300, Height = 20 }; this._TxtMonitoringPath.Style |= WindowStylesConst.WS_BORDER; this._BnSelectMonitoringPath = new NativeButton { Location = new Point(rightLeft + 301, top), Width = 25, Height = 20, Text = "…" }; this._BnSelectMonitoringPath.Clicked += BnSelectMonitoringPath_Click; top += 30; this._BnOk = new NativeButton { Width = 80, Height = 25, Location = new Point(this.Width - 33 - 81, top), Text = "&Ok" }; this._BnOk.Clicked += BnOk_Clicked; this._BnCancel = new NativeButton { Width = 80, Height = 25, Location = new Point(this._BnOk.Left - 10 - 80, top), Text = "&Cancel" }; this._BnCancel.Clicked += BnCancel_Clicked; top += 80; this.Height = top; this.Controls.Add(this._BnOk); this.Controls.Add(this._ChkContextMenu); this.Controls.Add(this._ChkDevTools); this.Controls.Add(this._ChkStatusBar); this.Controls.Add(this._ChkAppStatusBar); this.Controls.Add(lblTitle); this.Controls.Add(this._TxtTitle); this.Controls.Add(lblUrl); this.Controls.Add(this._TxtUrl); this.Controls.Add(lblUserFolder); this.Controls.Add(this._TxtUserDataFolder); this.Controls.Add(this._BnSelectUserDataFolder); this.Controls.Add(lblBrowserExecutable); this.Controls.Add(this._TxtBrowserExecutable); this.Controls.Add(this._BnSelectBrowserExecutable); this.Controls.Add(this._ChkMonitoring); this.Controls.Add(lblMonitoriingUrl); this.Controls.Add(this._TxtMonitoringUlr); this.Controls.Add(lblMonitoriingPath); this.Controls.Add(this._TxtMonitoringPath); this.Controls.Add(this._BnSelectMonitoringPath); this.Controls.Add(this._BnCancel); }
protected override void InitControls() { this.Text = CAPTION; this.Name = "Window1"; //this.StatusBar = false; // this.Left = 100; //this.Top = 100; this.Width = 600; this.Height = 400; this._ControlTest = new ControlTest(); this._ControlTest.Width = 200; this._ControlTest.Height = 30; this._ControlTest.Left = 300; this._ControlTest.Top = 80; this._ControlTest.Name = "TEST_CONTAINER"; //this.BackColor = ColorTool.LightGray; this.StartUpPosition = WindowsStartupPosition.CenterScreen; this.BackColor = ColorTool.White; this._Timer = new NativeTimer(); this._Timer.Interval = 100; //this._Timer.ControlId = 700; this._Timer.Tick += Timer_OnTick; this._Button = new NativeButton { Left = 10, Top = 10, Width = 100, Height = 30, Text = "Test", Name = "bnTest", BackColor = ColorTool.Blue, ForeColor = ColorTool.Green }; this._Button1 = new NativeButton { Left = 150, Top = 10, Width = 100, Height = 30, Text = "Test", Name = "bnTest"//, //ControlId = 505 }; this._Button.Clicked += button_OnClicked; this._Button.DblClicked += button_OnDblClicked; this._Button1.Clicked += button1_OnClicked; this._Button1.DblClicked += button1_OnDblClicked; this._Button3 = new NativeButton { Location = new Point(300, 10), Width = 20, Height = 30, Name = "SelectFolder", Text = "…" }; this._Button3.Clicked += Button3_Click; this._ComboBox = new NativeComboBox(); this._ComboBox.Location = new Point(350, 10); this._ComboBox.Height = 30; this._ComboBox.Width = 200; this._ComboBox.Name = "cbbTest"; this._ComboBox.ForeColor = ColorTool.Blue; this._ComboBox.BackColor = ColorTool.Green; this._ComboBox.Font = new Font() { Name = "Arial", Size = 10 }; this._ComboBox.SelChange += ComboBox_SelChange; this._TextBox = new NativeTextBox { Left = 10, Top = 50, Width = 100, Height = 30, Text = "ATEST", Name = "txtTest", Font = new Font() { Name = "Arial", Size = 14 }, ForeColor = ColorTool.Read //ControlId = 502 }; this._TextBox.Change += TextBox_Change; this._TextBox2 = new NativeTextBox { Left = 10, Top = 150, Width = 100, Height = 30, Text = "", Name = "txt2Test", //ControlId = 503, BackColor = ColorTool.Black, ForeColor = ColorTool.White }; this._Label1 = new NativeLabel { Left = 10, Top = 200, Width = 100, Height = 30, Text = "Dies ist ein Label"//, //BackColor=ColorTool.Read, //ForeColor = ColorTool.Green, //ControlId = 504 }; this._Label1.Clicked += Label1_Click; this._Label1.DblClicked += Label1_DblClick; this._Bitmap = new NativeBitmap(); this._Bitmap.BitMap = "Skype.bmp"; this._Bitmap.Left = 150; this._Bitmap.Top = 50; this._Bitmap.Width = 100; this._Bitmap.Height = 100; this._CheckBox = new NativeCheckBox(); this._CheckBox.Left = 300; this._CheckBox.Top = 50; this._CheckBox.Width = 200; this._CheckBox.Height = 30; this._CheckBox.Text = "TEST CHECKBOX"; this._CheckBox.BackColor = ColorTool.White; this._CheckBox.Checked = true; this._ListBox = new NativeListBox(); this._ListBox.Left = 300; this._ListBox.Top = 200; this._ListBox.Width = 400; this._ListBox.Height = 400; this._ListBox.BackColor = ColorTool.Yellow; this._ListBox.ForeColor = ColorTool.Read; this._ListBox.Font = new Font() { Name = "Arial", Size = 16 }; this._ListBox.MultiSelect = true; this._ListBox.DblClicked+=ListBox_DblClicked; this._ListBox.SelChange+=ListBox_SelChange; this._ProgressBar = new NativeProgress { Left = 10, Top = 250, Width = 150, Height = 30//, //ControlId = 507 }; this._TextBox.Clicked += TextBox_Click; this.Controls.Add(this._Button); this.Controls.Add(this._Button1); this.Controls.Add(this._Button3); this.Controls.Add(this._ComboBox); this.Controls.Add(this._TextBox); this.Controls.Add(this._TextBox2); this.Controls.Add(this._Label1); this.Controls.Add(this._Bitmap); this.Controls.Add(this._CheckBox); this.Controls.Add(this._ListBox); this.Controls.Add(this._ProgressBar); this.Controls.Add(this._Timer); this.Controls.Add(this._ControlTest); Click += Window1_Click; DoubleClick += Window1_DblClick; Create += Window1_Create; this.MouseMove += Window1_MoseMove; }
public static void UpdateIsChecked(this NativeCheckBox nativeCheckBox, ICheckBox check) { nativeCheckBox.IsChecked = check.IsChecked; }