private void OnNewProjectSettingsViewLoaded(object sender, RoutedEventArgs e) { TextBoxProjectName.Clear(); TextBoxProjectName.Focus(); TextBoxLocation.Clear(); TextBoxSolutionName.Clear(); CheckBoxProjectInRoot.IsChecked = false; }
public DialogWindowCreateProject() { InitializeComponent(); TextBoxProjectName.Focus(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { ListBoxCharacterSets.ItemsSource = _csManager; Title = _isNewProject ? "New Project" : $"Edit \"{Project.ProjectName}\" Settings"; // Select all character sets already represented in the project foreach (var characterSet in _originalCharacterSets) { ListBoxCharacterSets.SelectedItems.Add(characterSet); } // Configure bindings var binding = new Binding("ProjectName") { Source = Project, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; binding.ValidationRules.Add(new TextLengthRule(1, 255)); TextBoxProjectName.SetBinding(TextBox.TextProperty, binding); binding = new Binding("CharacterWidth") { Source = this, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; binding.ValidationRules.Add(new NumericTextRule(1, 64, 1.0) { NumberStyles = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign }); TextBoxCharacterWidth.SetBinding(TextBox.TextProperty, binding); binding = new Binding("CharacterHeight") { Source = this, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; binding.ValidationRules.Add(new NumericTextRule(1, 64, 1.0) { NumberStyles = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign }); TextBoxCharacterHeight.SetBinding(TextBox.TextProperty, binding); binding = new Binding("CharacterWidth") { Source = Project, Mode = BindingMode.TwoWay }; SetBinding(CharacterWidthProperty, binding); binding = new Binding("CharacterHeight") { Source = Project, Mode = BindingMode.TwoWay }; SetBinding(CharacterHeightProperty, binding); binding = new Binding("CharacterWidth") { Source = this }; MarginPixelGrid.SetBinding(PixelGrid.PixelGridWidthProperty, binding); binding = new Binding("CharacterHeight") { Source = this }; MarginPixelGrid.SetBinding(PixelGrid.PixelGridHeightProperty, binding); binding = new Binding("AscentHeight") { Source = Project, Mode = BindingMode.TwoWay }; TextBlockAscent.SetBinding(TextBlock.TextProperty, binding); MarginPixelGrid.SetBinding(GlyphPixelGrid.AscentHeightProperty, binding); binding = new Binding("DescentHeight") { Source = Project, Mode = BindingMode.TwoWay }; TextBlockDescent.SetBinding(TextBlock.TextProperty, binding); MarginPixelGrid.SetBinding(GlyphPixelGrid.DescentHeightProperty, binding); binding = new Binding("UppercaseHeight") { Source = Project, Mode = BindingMode.TwoWay }; TextBlockUppercase.SetBinding(TextBlock.TextProperty, binding); MarginPixelGrid.SetBinding(GlyphPixelGrid.UppercaseHeightProperty, binding); binding = new Binding("LowercaseHeight") { Source = Project, Mode = BindingMode.TwoWay }; TextBlockLowercase.SetBinding(TextBlock.TextProperty, binding); MarginPixelGrid.SetBinding(GlyphPixelGrid.LowercaseHeightProperty, binding); binding = new Binding("LeftBearingWidth") { Source = Project, Mode = BindingMode.TwoWay }; TextBlockLeftBearing.SetBinding(TextBlock.TextProperty, binding); MarginPixelGrid.SetBinding(GlyphPixelGrid.LeftBearingWidthProperty, binding); binding = new Binding("RightBearingWidth") { Source = Project, Mode = BindingMode.TwoWay }; TextBlockRightBearing.SetBinding(TextBlock.TextProperty, binding); MarginPixelGrid.SetBinding(GlyphPixelGrid.RightBearingWidthProperty, binding); _isLoading = false; e.Handled = true; }