void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.pelialue = ((WpfPelialue.PelialueControl)(target)); return; } this._contentLoaded = true; }
// Laskuria on muutettu. Päivitetään tieto myös textboxiin // parempi olisi bindata textbox tähän propertyyn: // {Binding ElementName=IkkunanNimi, Path=Laskuri} private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { PelialueControl pa = (PelialueControl)obj; pa.ColumnDefinitions.Clear(); pa.RowDefinitions.Clear(); Ellipse el = new Ellipse(); el.Fill = Brushes.Black; pa.Children.Add(el); for (int i = 0; i < pa.Koko; i++) { // Create Columns ColumnDefinition gridCol1 = new ColumnDefinition(); pa.ColumnDefinitions.Add(gridCol1); // Create Rows RowDefinition gridRow1 = new RowDefinition(); pa.RowDefinitions.Add(gridRow1); } for (int i = 0; i < pa.Koko; i++) { for (int j = 0; j < pa.Koko; j++) { Rectangle rect = new Rectangle(); rect.Fill = Brushes.Aqua; rect.Stroke = Brushes.Black; rect.SetValue(Grid.RowProperty, i); rect.SetValue(Grid.ColumnProperty, j); pa.Children.Add(rect); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ikkuna = ((WpfBreakthrough.MainWindow)(target)); return; case 2: this.print = ((System.Windows.Controls.Grid)(target)); return; case 3: this.menuReset = ((System.Windows.Controls.MenuItem)(target)); #line 16 "..\..\MainWindow.xaml" this.menuReset.Click += new System.Windows.RoutedEventHandler(this.menuReset_Click); #line default #line hidden return; case 4: this.menuQuit = ((System.Windows.Controls.MenuItem)(target)); #line 17 "..\..\MainWindow.xaml" this.menuQuit.Click += new System.Windows.RoutedEventHandler(this.menuQuit_Click); #line default #line hidden return; case 5: this.menuAbout = ((System.Windows.Controls.MenuItem)(target)); #line 20 "..\..\MainWindow.xaml" this.menuAbout.Click += new System.Windows.RoutedEventHandler(this.menuAbout_Click); #line default #line hidden return; case 6: this.menuSaannot = ((System.Windows.Controls.MenuItem)(target)); #line 21 "..\..\MainWindow.xaml" this.menuSaannot.Click += new System.Windows.RoutedEventHandler(this.menuSaannot_Click); #line default #line hidden return; case 7: this.menuAvustus = ((System.Windows.Controls.MenuItem)(target)); #line 22 "..\..\MainWindow.xaml" this.menuAvustus.Click += new System.Windows.RoutedEventHandler(this.menuAvustus_Click); #line default #line hidden return; case 8: this.pelialue = ((WpfPelialue.PelialueControl)(target)); return; case 9: this.asetukset = ((System.Windows.Controls.Grid)(target)); return; case 10: this.radioBreak = ((System.Windows.Controls.RadioButton)(target)); return; case 11: this.slideri = ((System.Windows.Controls.Slider)(target)); return; case 12: this.buttonAloita = ((System.Windows.Controls.Button)(target)); #line 48 "..\..\MainWindow.xaml" this.buttonAloita.Click += new System.Windows.RoutedEventHandler(this.buttonAloita_Click); #line default #line hidden return; case 13: this.textBoxP1 = ((System.Windows.Controls.TextBox)(target)); return; case 14: this.textBoxP2 = ((System.Windows.Controls.TextBox)(target)); return; case 15: this.p1vari = ((System.Windows.Controls.Button)(target)); #line 55 "..\..\MainWindow.xaml" this.p1vari.Click += new System.Windows.RoutedEventHandler(this.p1vari_Click); #line default #line hidden return; case 16: this.p2vari = ((System.Windows.Controls.Button)(target)); #line 56 "..\..\MainWindow.xaml" this.p2vari.Click += new System.Windows.RoutedEventHandler(this.p2vari_Click); #line default #line hidden return; case 17: this.r1vari = ((System.Windows.Controls.Button)(target)); #line 57 "..\..\MainWindow.xaml" this.r1vari.Click += new System.Windows.RoutedEventHandler(this.r1vari_Click); #line default #line hidden return; case 18: this.r2vari = ((System.Windows.Controls.Button)(target)); #line 58 "..\..\MainWindow.xaml" this.r2vari.Click += new System.Windows.RoutedEventHandler(this.r2vari_Click); #line default #line hidden return; case 19: this.buttonSave = ((System.Windows.Controls.Button)(target)); #line 59 "..\..\MainWindow.xaml" this.buttonSave.Click += new System.Windows.RoutedEventHandler(this.buttonSave_Click); #line default #line hidden return; case 20: this.buttonPrint = ((System.Windows.Controls.Button)(target)); #line 60 "..\..\MainWindow.xaml" this.buttonPrint.Click += new System.Windows.RoutedEventHandler(this.buttonPrint_Click); #line default #line hidden return; } this._contentLoaded = true; }