I have an app in c# where there is a dialog with components like buttons and comboBox..I want to add item to combobox but I don't know how I can find name of comboBox to add items in this way:
mybox.Items.Add(230);
mybox.Items.Add(231);
mybox.Items.Add(232);
mybox.Items.Add(233);
mybox.Items.Add(234);;
this is Maindow.g.i.cs of my app:
#pragma checksum "..\..\..\Views\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "672C0BA5C0622AB0E48A7C1162F67D388C4AE635"
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using WPFSDKSample;
using WPFSDKSample.ViewModels;
namespace WPFSDKSample {
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
private bool _contentLoaded;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/WPFSDKSample;component/views/mainwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\Views\MainWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
#line 58 "..\..\..\Views\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default
#line hidden
return;
case 2:
#line 93 "..\..\..\Views\MainWindow.xaml"
((System.Windows.Controls.ComboBox)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBox_SelectionChanged);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
}
}
source code:
<pre> <ComboBox SelectedItem="{Binding SelectedPrinter, Mode=OneWayToSource}" DisplayMemberPath="Name" MaxHeight="100" Width="250" SelectionChanged="ComboBox_SelectionChanged"/>
</StackPanel>
<StackPanel>
<Label FontWeight="Bold" FontSize="12">Roll selection (Twin turbo 450 printer)</Label>
<ComboBox ItemsSource="{Binding TwinTurboRolls}" SelectedItem="{Binding SelectedRoll, Mode=OneWayToSource}"></ComboBox>
<Label FontSize="11">*Only for Twin Turbo 450 printer</Label>
</StackPanel>
<StackPanel>
I changed:
<pre> <StackPanel>
<Label FontWeight="Bold" FontSize="12">Select printer</Label>
<ComboBox x:Name="ComboBox1" SelectedItem="{Binding SelectedPrinter, Mode=OneWayToSource}" DisplayMemberPath="Name" MaxHeight="100" Width="250" SelectionChanged="ComboBox_SelectionChanged" IsEditable="True" IsSynchronizedWithCurrentItem="False"/>
What I have tried:
I tried to click with right button of mouse on combobox in dialog but I don't see its name