Click here to Skip to main content
14,207,068 members

Silverlight / WPF

 
QuestionCreating DataGrid IN Code Behind Pin
Kevin Marois19-Sep-18 13:00
professionalKevin Marois19-Sep-18 13:00 
QuestionListBox UserControl Binding Problelm Pin
Kevin Marois18-Sep-18 12:03
professionalKevin Marois18-Sep-18 12:03 
AnswerRe: ListBox UserControl Binding Problelm Pin
Richard Deeming19-Sep-18 8:14
mveRichard Deeming19-Sep-18 8:14 
GeneralRe: ListBox UserControl Binding Problelm Pin
Kevin Marois19-Sep-18 8:58
professionalKevin Marois19-Sep-18 8:58 
QuestionDynamically Created DataGrids Binding Problem Pin
Kevin Marois17-Sep-18 6:44
professionalKevin Marois17-Sep-18 6:44 
AnswerRe: Dynamically Created DataGrids Binding Problem Pin
Gerry Schmitz17-Sep-18 15:00
mveGerry Schmitz17-Sep-18 15:00 
QuestionWPF MVVM textbox bind to SelectedItem issue Pin
miniboom6-Sep-18 3:32
memberminiboom6-Sep-18 3:32 
AnswerRe: WPF MVVM textbox bind to SelectedItem issue Pin
Mycroft Holmes6-Sep-18 12:47
memberMycroft Holmes6-Sep-18 12:47 
miniboom wrote:
i'm working now on alternative way and opening new window to add user
This is the way I do all data entry. Pop a modal dialog and allow the user to manage 1 record (SelectedProduct), save the record and update the collection.

As for your button command you do not want a SelectedProduct as the first thing you will do in the Add method is to create a new product.

I would do the following in your Add method:
Create SelectedProduct = new Product
Call the ShowDialogMethod

In your UpdateMethod
Call the ShowDialogMethod

ShowDialogMethod should
Instantiate the modal dialog (dialog view to reference the SelectedProduct)
Show the dialog

SaveDialog
Update the database
Either Add the new record to your product collection or update the SelectedProduct with the results of the database save.

There are a number of pitfalls depending on your DAL but once you have this methodology down pat it works for ALL your data entry needs.

I almost never use inline (in grid) editing, always pop a dialog it gives you dramatically more control of your record.

For simple data entry I used the same VM as the list. If the dialog is complex I will use a separate VM for it.
Never underestimate the power of human stupidity
RAH

GeneralRe: WPF MVVM textbox bind to SelectedItem issue Pin
miniboom7-Sep-18 5:40
memberminiboom7-Sep-18 5:40 
GeneralRe: WPF MVVM textbox bind to SelectedItem issue Pin
Mycroft Holmes7-Sep-18 11:15
memberMycroft Holmes7-Sep-18 11:15 
QuestionPlease help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 10:00
memberPew_new4-Sep-18 10:00 
AnswerRe: Please help me to figure out a purpose of this code. Pin
Mycroft Holmes4-Sep-18 11:29
memberMycroft Holmes4-Sep-18 11:29 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 18:31
memberPew_new4-Sep-18 18:31 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Mycroft Holmes4-Sep-18 19:18
memberMycroft Holmes4-Sep-18 19:18 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 22:25
memberPew_new4-Sep-18 22:25 
AnswerRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 21:52
protectorRichard MacCutchan4-Sep-18 21:52 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 22:30
memberPew_new4-Sep-18 22:30 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 22:38
protectorRichard MacCutchan4-Sep-18 22:38 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 22:45
memberPew_new4-Sep-18 22:45 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 23:07
protectorRichard MacCutchan4-Sep-18 23:07 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 23:12
memberPew_new4-Sep-18 23:12 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 23:35
protectorRichard MacCutchan4-Sep-18 23:35 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Mycroft Holmes5-Sep-18 11:21
memberMycroft Holmes5-Sep-18 11:21 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan5-Sep-18 21:45
protectorRichard MacCutchan5-Sep-18 21:45 
AnswerRe: Please help me to figure out a purpose of this code. Pin
Pete O'Hanlon5-Sep-18 0:44
protectorPete O'Hanlon5-Sep-18 0:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190612.1 | Last Updated 12 Jun 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid