|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
BindingSource-Klasse
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.BindingSource
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Der BindingSource-Typ macht die folgenden Member verfügbar.
| Name | Beschreibung | |
|---|---|---|
![]() | BindingSource() | |
![]() | BindingSource(IContainer) | |
![]() | BindingSource(Object, String) |
| Name | Beschreibung | |
|---|---|---|
![]() | AllowEdit | |
![]() | AllowNew | |
![]() | AllowRemove | |
![]() | CanRaiseEvents | |
![]() | Container | |
![]() | Count | |
![]() | CurrencyManager | |
![]() | Current | |
![]() | DataMember | |
![]() | DataSource | |
![]() | DesignMode | |
![]() | Events | |
![]() | Filter | |
![]() | IsBindingSuspended | |
![]() | IsFixedSize | |
![]() | IsReadOnly | |
![]() | IsSorted | |
![]() | IsSynchronized | |
![]() | Item | |
![]() | List | |
![]() | Position | |
![]() | RaiseListChangedEvents | |
![]() | Site | |
![]() | Sort | |
![]() | SortDescriptions | |
![]() | SortDirection | |
![]() | SortProperty | Infrastruktur. |
![]() | SupportsAdvancedSorting | |
![]() | SupportsChangeNotification | |
![]() | SupportsFiltering | |
![]() | SupportsSearching | |
![]() | SupportsSorting | |
![]() | SyncRoot |
| Name | Beschreibung | |
|---|---|---|
![]() | Add | |
![]() | AddNew | |
![]() | ApplySort(ListSortDescriptionCollection) | |
![]() | ApplySort(PropertyDescriptor, ListSortDirection) | |
![]() | CancelEdit | |
![]() | Clear | |
![]() | Contains | |
![]() | CopyTo | |
![]() | CreateObjRef | |
![]() | Dispose() | |
![]() | Dispose(Boolean) | |
![]() | EndEdit | |
![]() | Equals(Object) | |
![]() | Finalize | |
![]() | Find(PropertyDescriptor, Object) | |
![]() | Find(String, Object) | |
![]() | GetEnumerator | |
![]() | GetHashCode | |
![]() | GetItemProperties | |
![]() | GetLifetimeService | |
![]() | GetListName | |
![]() | GetRelatedCurrencyManager | |
![]() | GetService | |
![]() | GetType | |
![]() | IndexOf | |
![]() | InitializeLifetimeService | |
![]() | Insert | |
![]() | MemberwiseClone() | |
![]() | MemberwiseClone(Boolean) | |
![]() | MoveFirst | |
![]() | MoveLast | |
![]() | MoveNext | |
![]() | MovePrevious | |
![]() | OnAddingNew | |
![]() | OnBindingComplete | |
![]() | OnCurrentChanged | |
![]() | OnCurrentItemChanged | |
![]() | OnDataError | |
![]() | OnDataMemberChanged | |
![]() | OnDataSourceChanged | |
![]() | OnListChanged | |
![]() | OnPositionChanged | |
![]() | Remove | |
![]() | RemoveAt | |
![]() | RemoveCurrent | |
![]() | RemoveFilter | |
![]() | RemoveSort | |
![]() | ResetAllowNew | Infrastruktur. |
![]() | ResetBindings | |
![]() | ResetCurrentItem | |
![]() | ResetItem | |
![]() | ResumeBinding | |
![]() | SuspendBinding | |
![]() | ToString |
| Name | Beschreibung | |
|---|---|---|
![]() | AddingNew | |
![]() | BindingComplete | |
![]() | CurrentChanged | |
![]() | CurrentItemChanged | |
![]() | DataError | |
![]() | DataMemberChanged | |
![]() | DataSourceChanged | |
![]() | Disposed | |
![]() | ListChanged | |
![]() | PositionChanged |
| Name | Beschreibung | |
|---|---|---|
![]() | AsParallel | |
![]() | AsQueryable | |
![]() | Cast<TResult> | |
![]() | OfType<TResult> |
| Name | Beschreibung | |
|---|---|---|
![]() ![]() | IBindingList.AddIndex | |
![]() ![]() | IBindingList.RemoveIndex | |
![]() ![]() | ICancelAddNew.CancelNew | |
![]() ![]() | ICancelAddNew.EndNew | |
![]() ![]() | ISupportInitialize.BeginInit | |
![]() ![]() | ISupportInitialize.EndInit | |
![]() ![]() | ISupportInitializeNotification.Initialized | |
![]() ![]() | ISupportInitializeNotification.IsInitialized |
Verwenden Sie Add-Methode zum Hinzufügen eines Elements BindingSource Komponente. Legen Sie fest DataSource-Eigenschaft in einer Liste zu einem einzelnen Objekt oder einen Typ.
Hinweis |
|---|
Vorsicht |
|---|
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; namespace BindingSourceExamples { public class Form1 : Form { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Form1()); } public Form1() { this.Load += new EventHandler(Form1_Load); } private TextBox textBox1; private Button button1; private ListBox listBox1; private BindingSource binding1; void Form1_Load(object sender, EventArgs e) { listBox1 = new ListBox(); textBox1 = new TextBox(); binding1 = new BindingSource(); button1 = new Button(); listBox1.Location = new Point(140, 25); listBox1.Size = new Size(123, 160); textBox1.Location = new Point(23, 70); textBox1.Size = new Size(100, 20); textBox1.Text = "Wingdings"; button1.Location = new Point(23, 25); button1.Size = new Size(75, 23); button1.Text = "Search"; button1.Click += new EventHandler(this.button1_Click); this.ClientSize = new Size(292, 266); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.Controls.Add(this.listBox1); MyFontList fonts = new MyFontList(); for (int i = 0; i < FontFamily.Families.Length; i++) { if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Regular)) fonts.Add(new Font(FontFamily.Families[i], 11.0F, FontStyle.Regular)); } binding1.DataSource = fonts; listBox1.DataSource = binding1; listBox1.DisplayMember = "Name"; } private void button1_Click(object sender, EventArgs e) { if (binding1.SupportsSearching != true) MessageBox.Show("Cannot search the list."); else { int foundIndex = binding1.Find("Name", textBox1.Text); if (foundIndex > -1) listBox1.SelectedIndex = foundIndex; else MessageBox.Show("Font was not found."); } } } public class MyFontList : BindingList<Font> { protected override bool SupportsSearchingCore { get { return true; } } protected override int FindCore(PropertyDescriptor prop, object key) { // Ignore the prop value and search by family name. for (int i = 0; i < Count; ++i) { if (Items[i].FontFamily.Name.ToLower() == ((string)key).ToLower()) return i; } return -1; } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core-Rolle wird nicht unterstützt), Windows Server 2008 R2 (Server Core-Rolle wird mit SP1 oder höher unterstützt; Itanium wird nicht unterstützt)
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.


