last day (14 days later) » 

1:46 PM
1
A: WPF DataGrid Dymanic Column binding

kennyzxIn order to update the stock prices and add new stocks at runtime, Stock should implement INotifyPropertyChanged and use ObservableCollection instead of List<Stock>. Expose the stock list via a public property, from the post you can also learn how to set the DataContext and ItemsSource of the D...

 
Thanks For the answer i think this should work fine but i need custom height for row 1 because i need to display image in that. Can you please guide me how to set different height for rows?
 
You need to play with DataTemplate. I have uploaded a demo project for you to get started.
 
That was amazing help, Thanks a lot.
Just one more small help how to set background color to row 2 at runtime as we have added image.
 
Please contact me via gmail, just in case we need to discuss a lot that would not be helpful to other readers. Explain this small requirement in mail.
 
can i have your gmail id?
 
1:46 PM
ikennyzx@gmail.com
hi
I forget we can chat
so do you mean row 2 has a background color?
 
i have sent you a mail.
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="{Binding Row1Color}" />
</Style>
</DataGridTextColumn.CellStyle>
i tried using above code
but not working for me
 
oh
that should be set somewhere else
you want the entire row have a background color?
 
only current price and old price will show Yellow color if value is greater then 0 else no color(White) for negative blue will be used
can i bind color as i tired using above ?
 
2:01 PM
just like you mark negative values in blue in Excel sheet
and yellow for positive value, right?
 
yes
 
ok
come back to you in 5 minutes
it involves something called a converter
 
current price will change in realtime from database so as soon as value change i will change color from code. as currently you helped me with image. I will also change the image as soon as value change and i have tested it.. it is working fine.
 
you don;t need to change color...
just update the price.
the binding will do the work for you. the color is bind to the price.
see my code and you will understand the meaning
 
2:18 PM
reply you in gmail
there is a converter
add a break point in the converter, you will know how it works
 
ok let me try it
 
3:09 PM
time to bed
if you have other problem
reply me in mail. cu
 
3:52 PM
That is great awesome help bro :) everything is working amazing :)
 

last day (14 days later) »