Hi,
ich habe ein Tab Control. Jeder Tab ist ein User Control mit verschiedenen Elementen. In einem Tab habe ich ein GridView. Dies soll einen Header Namen und einen Funktion enthalten.
Nun klappt der erste Schritt, nachdem in einem anderen Tab die Namen gefüllt wurden, diese hier einzufügen mithilfe eines Bindings.
Die Combobox funktioniert aber nicht. Es erscheint nichtmal eine Combobox, einfach nur ein leeres Feld an der Stelle.
Hier Code:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| <UserControl x:Class="Tab_Control.AddPin" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="700"> <Grid> <DataGrid Name="PadNames" AutoGenerateColumns="False" HorizontalAlignment="Left" Width="283"> <DataGrid.Columns> <DataGridTextColumn x:Name="PinNames" Header="PinNames" Binding="{Binding PadName}" /> <DataGridComboBoxColumn Header="SelectedFunktion" Width="100" x:Name="Funktionen" SelectedValueBinding="{Binding Funktionen, Mode=TwoWay}" DisplayMemberPath="{Binding Funktionen}" /> </DataGrid.Columns> </DataGrid> </Grid> </UserControl> |
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9:
| using System.Collections.Generic; public class AddPadCatalogue {
public string PadName { get; set; }
public List<string> Funktionen { get; set; }
} |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31:
| public partial class AddPin : UserControl { public List<string> Functions { get; set; }
public AddPin() { InitializeComponent(); }
public void jointab_AddPin() {
Functions = new List<string>(); Functions.Add("Male"); Functions.Add("Female");
ObservableCollection<AddPadCatalogue> PadCatalogue = new ObservableCollection<AddPadCatalogue>();
for (int i = 0; i < PortFunctions.exceptionPFs.Count; i++) {
PadCatalogue.Add(new AddPadCatalogue() { PadName = Pads.AddablePads[i], Funktionen=Functions }); }
PadNames.ItemsSource = PadCatalogue; Funktionen.ItemsSource = Functions;
}
} |