datagrid

WPF DataGrid RowEditEnding Event to call Update

▼魔方 西西 提交于 2020-01-06 17:57:31
问题 I am using WPF . . . datagrid bound to a database via the VisualStudio IDE drag and drop, and found a way to have my datagrid update and add to the database in real time using the RowEditEnding event thusly: private void Update_WatchList(object sender, DataGridRowEditEndingEventArgs e) { UpdateWatchList(); } private void UpdateWatchList() { dsDocControlTableAdapters.DocumentWatchListTableAdapter ta = new dsDocControlTableAdapters.DocumentWatchListTableAdapter(); try { DataRowView dr =

adding items to a combobox in the datagrid

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 15:32:37
问题 ive got a simple datagrid made out of comboboxes and textboxes. the last field named "cost" is a textbox,result of the combination of the comboboxes selected. Here's the xaml: <DataGrid AutoGenerateColumns="False" x:Name="myGrid" ItemsSource="{Binding Path=Routes,UpdateSourceTrigger=PropertyChanged}" > <DataGrid.Columns> <DataGridTextColumn Header="Sequenza N°"/> <DataGridComboBoxColumn Width="100" x:Name="Product" SelectedValueBinding="{Binding Product, Mode=TwoWay,UpdateSourceTrigger

C# wpf xaml datagrid binding

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 13:12:52
问题 I want the following datagrid: Name questionpar1 | Name QuestionPar2 | Name QuestionPar3 | ... string qp1 of var1 | string qp2 of var1 | string qp3 of var1 | ... string qp1 of var2 | string qp2 of var2 | string qp3 of var2 | ... ... these are my classes: Question with property IEnumerable<Variation> Variations Variation with property IEnumerable<<keyValuePair<QuestionParameter,string>>> QuestionParameters QuestionParameter has the property Name which is a string Can Someone show me the code

WPF Datagrid/Listview INVERTED?

喜你入骨 提交于 2020-01-06 13:11:30
问题 Is Possible to get a datagrid (or listview) control inverted? For example, usually we have a listview like this: Name Age Job John 23 eng Now I want to invert the table: Label 1col Name John Age 23 Job eng Thus we can able to select the single column... 回答1: Current WPF DataGrid dioes not perform this straight away... But there are options... XML Way XML format of data can help you to achieve this. e.g <Employees> <Employee> <FirstName>A</FirstName> <LastName>B</LastName> </Employee>

Get cell values from a WPF datagrid that has been populated with anonymous types

£可爱£侵袭症+ 提交于 2020-01-06 12:36:33
问题 I have a datagrid that I populated with 2 arrays of strings by following the process as outlined in this question here Now when Im trying to get selected cell values im struggling with pulling the cell values back out. So far I have: IList rows = dgMain.SelectedItems; Which returns a list of the selected items, where the first item contains an object with the username and password. My question is how do I access the username and password? I guess I need to cast the object in the list to

WPF: How to handle multi-XAML UIs? (Follow-Up)

梦想的初衷 提交于 2020-01-06 07:03:31
问题 This is a continuation of my previous thread: WPF: How to handle multi-XAML UIs? The proposed solution (thanks again, HighCore!!) is important and I added it to my growing coding arsenal. A User Control seems to be geared to controls that are fully debugged and ready (a read-only library, if you will) because no visual editing is provided. What I need is to add a couple new XAML files (one for a DataGrid inside my left tab and another for the DataGrid inside my right tab). My main (caller)

WPF: How to handle multi-XAML UIs? (Follow-Up)

◇◆丶佛笑我妖孽 提交于 2020-01-06 07:03:04
问题 This is a continuation of my previous thread: WPF: How to handle multi-XAML UIs? The proposed solution (thanks again, HighCore!!) is important and I added it to my growing coding arsenal. A User Control seems to be geared to controls that are fully debugged and ready (a read-only library, if you will) because no visual editing is provided. What I need is to add a couple new XAML files (one for a DataGrid inside my left tab and another for the DataGrid inside my right tab). My main (caller)

How to bind collection to datagrid column in WPF

时间秒杀一切 提交于 2020-01-06 06:48:38
问题 I have the following model: public class Order { public Order() { Specifications = new List<string>(); } public Guid Id { get; set; } public DateTime CreateDate { get; set; } public ICollection<string> Specifications { get; set; } } public class Context: INotifyPropertyChanged { private ObservableCollection<Order> orders; public ObservableCollection<Order> Orders { get { return orders; } set { orders = new ObservableCollection<Order>(value); } } } I am binding the collection to datagrid in

Bind a DataGrid to the selectedrow object of a second datagrid, WPF Caliburn.Micro

三世轮回 提交于 2020-01-06 06:45:49
问题 I have a datagrid that is bound to a BindableCollection, this is working properly, every repair order I add to the BindableCollection shows in the Datagrid. I have a second Datagrid on the same view for "WriteOffs", Each "RepairOrder" has a property of BindableCollection. What I am trying to do is bind the WriteOff DataGrid to the WriteOffs of the selected row. So every time the user selects a row in the "RepairOrder" datagrid the write offs stored in the writeoff property is shown in the

MVVM load model data when the Page loads

我只是一个虾纸丫 提交于 2020-01-06 05:26:37
问题 By implementing MVVM [possibly] correctly using this blog post as an example, I managed to get my data showing on my DataGrid. See my previous question for history. The only thing is that the DataGrid only binds to my data when I execute ListCampaignsCommand on my ViewModel which I'm currently doing through a Button Command: <!-- Pages\ManageCampaigns.xaml --> <Button Name="btnRefresh" Grid.Column="0" Command="{Binding ListCampaignsCommand}" Style="{StaticResource TitleButtonLink}" Margin="20