Click here to Skip to main content
15,881,281 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Creating DataGrid IN Code Behind Pin
Gerry Schmitz24-Sep-18 6:34
mveGerry Schmitz24-Sep-18 6:34 
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
miniboom6-Sep-18 3:32 
Hi everyone,

i need some help, doing a school work, i'm using a datagrid to display some info from my database.
<DataGrid x:Name="dataGridProduit" SelectionMode="Single" AutoGenerateColumns="false"
                  ItemsSource="{Binding MyProducts}" 
                  SelectedItem="{Binding SelectedProduct, Mode=TwoWay}">
<DataGridTextColumn x:Name="Nom" Header="Nom" Binding="{Binding Name, Mode=TwoWay}" Width="*"/>


Then textbox filled with info from selectedItem
<TextBox x:Name="tbName" Height="23" Text="{Binding SelectedProduct.Name, Mode=TwoWay}"

works fine for remove,update.
But now, i'd like to add new product this way :
<Button x:Name="buttonAdd" Style="{DynamicResource ButtonStyleMainWindow}" Command="{Binding AddCommand}" CommandParameter="{Binding SelectedProduct}" />

The problem is clear, it adds but also update my selectedProduct. What would be the best solution here? other issue is, if i just fill the textboxes, then i don't raise a selectedProduct to viewmodel and then my object is null :/

i'm working now on alternative way and opening new window to add user but really i'm blind on the best way to do this

so thank u for any help u can give to me Smile | :)

modified 6-Sep-18 10:01am.

AnswerRe: WPF MVVM textbox bind to SelectedItem issue Pin
Mycroft Holmes6-Sep-18 12:47
professionalMycroft Holmes6-Sep-18 12:47 
GeneralRe: WPF MVVM textbox bind to SelectedItem issue Pin
miniboom7-Sep-18 5:40
miniboom7-Sep-18 5:40 
GeneralRe: WPF MVVM textbox bind to SelectedItem issue Pin
Mycroft Holmes7-Sep-18 11:15
professionalMycroft Holmes7-Sep-18 11:15 
QuestionPlease help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 10:00
Pew_new4-Sep-18 10:00 
AnswerRe: Please help me to figure out a purpose of this code. Pin
Mycroft Holmes4-Sep-18 11:29
professionalMycroft Holmes4-Sep-18 11:29 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 18:31
Pew_new4-Sep-18 18:31 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Mycroft Holmes4-Sep-18 19:18
professionalMycroft Holmes4-Sep-18 19:18 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 22:25
Pew_new4-Sep-18 22:25 
AnswerRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 21:52
mveRichard MacCutchan4-Sep-18 21:52 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 22:30
Pew_new4-Sep-18 22:30 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 22:38
mveRichard MacCutchan4-Sep-18 22:38 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 22:45
Pew_new4-Sep-18 22:45 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 23:07
mveRichard MacCutchan4-Sep-18 23:07 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Pew_new4-Sep-18 23:12
Pew_new4-Sep-18 23:12 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan4-Sep-18 23:35
mveRichard MacCutchan4-Sep-18 23:35 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Mycroft Holmes5-Sep-18 11:21
professionalMycroft Holmes5-Sep-18 11:21 
GeneralRe: Please help me to figure out a purpose of this code. Pin
Richard MacCutchan5-Sep-18 21:45
mveRichard MacCutchan5-Sep-18 21:45 

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.