public MainWindow() { this.InitializeComponent(); MyList = PopulateMyList(); MyIndicators = new IndicatorsViewModel(); //Create and add DataGrid to the window CodedControlsGrid.Children.Add(MakeDataGrid()); //Create and add Standatrd Button to the window NewButtonsStack.Children.Add(MakeStandardButton()); //Create and add Enhanced Button to the window NewButtonsStack.Children.Add(MakeEnhancedButton()); //Create default CheckBox var cb = MakeCheckbox("Microsoft.Windows.Themes.BulletChrome"); cb.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsChecked") { Source = MyIndicators }); NewCheckBoxesStack.Children.Add(cb); //Create CheckBoxes with custom bullets (Images) NewCheckBoxesStack.Children.Add(MakeCheckbox("Media/ThumbsUp.png")); NewCheckBoxesStack.Children.Add(MakeCheckbox("Media/Tick.jpg")); // Create default label //NewCheckBoxesStack.Children.Add(MakeLabel()); // Binding DataContext to itself DataContext = this; }
public MainWindow() { this.InitializeComponent(); MyList = PopulateMyList(); MyIndicators = new IndicatorsViewModel(); LayoutRoot.Children.Add(MakeDataGrid()); var button = MakeButton(); // Test breaking the property binding code here // Comment out lines from ButtonFactory.cs and test here. button.BorderBrush = Brushes.Red; // Works. Now comment out Buttonfactory.cs line 39 and try again LayoutRoot.Children.Add(button); DataContext = this; }