English 中文(简体)
如何从数据网中提取数据?
原标题:How to extract data from datagrid in wpf?

我难以从数据网中提取数据。 自2006年以来 我正在使用数据网的甄选交换活动。 我获得了选定的行文和栏目索引。 但是,我找不到任何财产从数据网或数据网或选定细胞获得准确数据。 希望得到你们的gu们的一些建议。

最佳回答

附上你的数据,然后附上你的数据。 选定项目将成为贵项目的项目。

你在使用ComboBoxes方面有过评论,因此这里就是一个例子:

<DataGrid ItemsSource="{Binding MyData}" AutoGernateColumns="False">
    <DataGrid.Columns>
        <DataGridComboBoxColumn ItemsSource="{Binding Path=DataContext.ComboBoxOptions, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                                DisplayMemberPath="Name"
                                SelectedValuePath="Id"
                                SelectedValueBinding="OptionId" />
    </DataGrid.Columns>
</DataGrid>

贵数据组的数据目录将包括:

ObservableCollection<SomeItem> MyData { get; set; }
ObservableCollection<Option> ComboBoxOptions{ get; set; }

The SomeItem class would have a property of OptionId, and the Option class would have an Id and Name field.

例如,当你在数据表中选择一个项目时,<代码> 数据单 <代码> 缩略语

在WPF中,你的数据(DataContext)是你的申请,而你像ComboBoxes、文本Boxes、数据Grids等元数据只是一个简单的接口,让用户与你的数据互动。

问题回答

页: 1 活动,使用数据Grid1。 Selected Iteam as Object.

守则应当大致如下:

    private void dataGrid1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        edit(this.dataGrid1.SelectedItem as YourObject);
    }




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签