Created
September 22, 2016 21:02
-
-
Save cathode/955c9a6be23de1d4062420840e1ab8f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WPF: | |
<DataGrid x:Name="objectList" Height="auto" VerticalAlignment="Stretch" MinWidth="300" Width="auto" ItemsSource="{Binding Objects}" AutoGenerateColumns="False" Margin="10,39,10,10" CanUserAddRows="False" CanUserReorderColumns="False" CanUserDeleteRows="False" RowHeight="24"> | |
<DataGrid.Columns> | |
<DataGridTextColumn Header="Id" Binding="{Binding ObjectId}" Width="60" IsReadOnly="True" /> | |
<DataGridTextColumn Header="Name" Binding="{Binding ObjectName}" Width="200" IsReadOnly="False" /> | |
<DataGridTextColumn Header="Key Column" Binding="{Binding PrimaryKeyColumn}" Width="160" IsReadOnly="False" /> | |
<DataGridComboBoxColumn Header="ObjectKind" SelectedItemBinding="{Binding ObjectKind, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Source={StaticResource ObjectKindValues}}" Width="96"/> | |
</DataGrid.Columns> | |
</DataGrid> | |
View model (data context): | |
public ObservableCollection<LinkObject> Objects { get; private set; } | |
Model: | |
public class LinkObject | |
{ | |
public LinkObject() | |
{ | |
} | |
[Key] | |
public int ObjectId { get; set; } | |
public int DatabaseId { get; set; } | |
public ObjectKind ObjectKind { get; set; } | |
public string ObjectName { get; set; } | |
public string PrimaryKeyColumn { get; set; } | |
[ForeignKey("DatabaseId")] | |
public virtual LinkDatabase Database { get; set; } | |
public ICollection<LinkObjectMapping> Mappings { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment