1
Answer

How to retrieve a line selected in datagridview

Photo of ma ouml

ma ouml

8y
276
1
Hi friends
I have a datagridview contains a column checkbox
Now I want that when I select a line in datagridview from the checkbox and I click button save I retrieve the line as well as some values
How do I please and thank you in advance
 
 
 

Answers (1)

1
Photo of Prakash Kumar
NA 1.6k 46.7k 8y
Refer this link,
 
http://www.c-sharpcorner.com/blogs/dynamic-menu-in-wpf122 
0
Photo of vipin kv
NA 200 0 8y
ViewModel
-------------------- 
public class MenuItemViewModel
{
public MenuItemViewModel()
{
this.MenuItems = new List<MenuItemViewModel>();
}
public string Text { get; set; }
public IList<MenuItemViewModel> MenuItems { get; private set; }
}
 
XAML Code
----------------------- 
<Window.Resources>
<HierarchicalDataTemplate DataType="{x:Type self:MenuItemViewModel}"
ItemsSource="{Binding Path=MenuItems}">
<ContentPresenter Content="{Binding Path=Text}" />
</HierarchicalDataTemplate>
</Window.Resources>
<DockPanel>
<Menu DockPanel.Dock="Top" ItemsSource="{Binding Path=MenuItems}" />
<Grid />
</DockPanel>