TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
chirag patel
NA
89
6k
How to bind nested datagridview in WPF C#
May 4 2020 8:29 AM
<DataGrid Margin="10 10 10 10" ItemsSource="{Binding}" Height="300" x:Name="dataGrid1" IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<!--Action Button Start-->
<DataGridTemplateColumn Header="Action">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Border Margin="5" BorderThickness="1,1,1,1" BorderBrush="#D3D3D3" CornerRadius="2" >
<Label Cursor="Hand" Background="Yellow" ToolTip="Edit" MouseLeftButtonUp="Edit_OnClick" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Center">
</Label>
</Border>
<Border Margin="5" BorderThickness="1,1,1,1" BorderBrush="#D3D3D3" CornerRadius="2" >
<Label Cursor="Hand" Background="Red" ToolTip="Delete" MouseLeftButtonUp="Delete_OnClick" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Center">
</Label>
</Border>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Action Button End-->
<DataGridTextColumn Header="ID" Binding="{Binding c_sid}" Width="SizeToHeader"/>
<DataGridTextColumn Header="Invoice Date" Binding="{Binding c_invoicedate}"/>
<DataGridTextColumn Header="Invoice No" Binding="{Binding c_invoiceno}"/>
<DataGridTextColumn Header="Partyname" Binding="{Binding c_partyname}"/>
<DataGridTextColumn Header="Hastee" Binding="{Binding c_hastee}"/>
<DataGridTextColumn Header="Tax" Binding="{Binding c_tax}"/>
<DataGridTextColumn Header="Discount" Binding="{Binding c_discount}"/>
<DataGridTextColumn Header="Total" Binding="{Binding c_total}"/>
</DataGrid.Columns>
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<Expander Expanded="Expander_Expanded" Collapsed="Expander_Collapsed">
</Expander>
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<ListView Name="Subgrid" ItemsSource="{Binding}" >
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding c_sku}" Header="SKU" />
<GridViewColumn DisplayMemberBinding="{Binding c_qty}" Header="Quantity" />
<GridViewColumn DisplayMemberBinding="{Binding c_price}" Header="Price" />
</GridView>
</ListView.View>
</ListView>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
Reply
Answers (
2
)
how to add table in wpf richtext control by code in c#
Changing the backcolor of a single cell in datatable