Skip to content

Instantly share code, notes, and snippets.

@FoggyFinder
Created December 5, 2016 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FoggyFinder/b15c349c46ff40105213956cbd651269 to your computer and use it in GitHub Desktop.
Save FoggyFinder/b15c349c46ff40105213956cbd651269 to your computer and use it in GitHub Desktop.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fsxaml="http://github.com/fsprojects/FsXaml"
Title="MVVM and XAML Type provider"
Width="400"
Height="200">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button HorizontalAlignment="Center"
Command="{Binding CreateCommand}"
Content="Create" />
<DataGrid Grid.Row="1"
AutoGenerateColumns="False"
ItemsSource="{Binding Model}">
<DataGrid.Columns>
<DataGridTextColumn Width="*"
Binding="{Binding .}"
Header="Value" />
<DataGridTemplateColumn Width="Auto" Header="+">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button MinWidth="50"
MaxWidth="50"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type DataGrid}},
Path=DataContext.Up}"
CommandParameter="{Binding RelativeSource={RelativeSource Self},
Path=DataContext}"
Content="^" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment