c# - Showing a SelectedItem's Property -
So I have enabled a rightclick option for my DataGrid. I want to display the only chosen property but it is not behaving like what I would like it to display my name and additional.
Public category Paymentinfo {public int PaymentNo {get; Set; } Public string date {get; Set; } Public Double Pay {get; Set; } Public Double Principle {get; Set; } Public Double Interest {get; Set; } Public Double Balance {Received; Set; }} Private Zero MenuItem_OnClick (Object Sender, RoutedEventArgs e) {MessageBox.Show (AmortGrid.SelectedItem.ToString ()); }
I'm trying to apply it without using a View Module! If I place a breakpoint where the messagebox and the recipient place it on selected ITEM, then this property will display the payment. A date-payment-principle-interest-balance is the only value that needs payment.
Was hoping that it would be something like this
MessageBox.Show (AmortGrid.SelectedItem.PaymentNo.ToString ());
When you call ToString ()
So you get the class type name that you are looking for.
If this is the PaymentInfo
, the type of cast
message box. Show (AmortGrid.SelectedItem PaymentInfo). no payment. Toastring ());
FWIW, I used to reconsider ViewModel
. If you get it from the code-back, then your code is easy to test.
You can see the selected item
directly in ViewModel
(which is probably called PaidInfo), and then anybody with casting Will not mess up.
Comments
Post a Comment