Patience! Oh Patience, that can bear so much!
-
O, pazienza, pazienza che tanto sostieni! (Dante) Patience! Oh patience that can bear so much! I battled for more than two days in a Prism application to get events in a Blend-type behavior to work. The behavior was supposed to set the headings for a DataGrid when the ItemsSource for the DataGrid was set to a specific DataTable. The DataGrid was set to autogenerate columns. I got some really weird effects, until I finally figured out I had to introduce a 100 millisecond delay after the View that held the DataGrid loaded, before I loaded the DataTable. Suddenly all weirdness was gone! All that was needed was patience for a 100 ms delay after the View loaded! I introduced the delay using the DispatcherTimer. A lesson learnt costing me two days of my life!
Get me coffee and no one gets hurt!
-
O, pazienza, pazienza che tanto sostieni! (Dante) Patience! Oh patience that can bear so much! I battled for more than two days in a Prism application to get events in a Blend-type behavior to work. The behavior was supposed to set the headings for a DataGrid when the ItemsSource for the DataGrid was set to a specific DataTable. The DataGrid was set to autogenerate columns. I got some really weird effects, until I finally figured out I had to introduce a 100 millisecond delay after the View that held the DataGrid loaded, before I loaded the DataTable. Suddenly all weirdness was gone! All that was needed was patience for a 100 ms delay after the View loaded! I introduced the delay using the DispatcherTimer. A lesson learnt costing me two days of my life!
Get me coffee and no one gets hurt!
so there must be a delay after the view load? :doh:
-
O, pazienza, pazienza che tanto sostieni! (Dante) Patience! Oh patience that can bear so much! I battled for more than two days in a Prism application to get events in a Blend-type behavior to work. The behavior was supposed to set the headings for a DataGrid when the ItemsSource for the DataGrid was set to a specific DataTable. The DataGrid was set to autogenerate columns. I got some really weird effects, until I finally figured out I had to introduce a 100 millisecond delay after the View that held the DataGrid loaded, before I loaded the DataTable. Suddenly all weirdness was gone! All that was needed was patience for a 100 ms delay after the View loaded! I introduced the delay using the DispatcherTimer. A lesson learnt costing me two days of my life!
Get me coffee and no one gets hurt!
start /wait
-- a gift from God.I wanna be a eunuchs developer! Pass me a bread knife!
-
so there must be a delay after the view load? :doh:
Keep in mind that the View's loaded event fires before it is rendered and becomes visible. There are still UI element activity after the event fired. If the View is a window, I will prefer to use the ContentRendered event, but in Prism the View is usually a UserControl, that does not have a ContentRendered event.
Get me coffee and no one gets hurt!