private void AddMemberClick(object sender, RoutedEventArgs e) { Sponsor.AddMember(); MatchesColumn.GridSplitterOpeningBounce(true, 300); //open the existing customers sidebar so the following message makes sense App.ShowUserMessage("Fill in SSN & Name first.\n" + "Use the \"Existing Customers\" list on the right to move existing members into this household.\n" + "Then use the \"Set Spouse\" button in the Members grid where applicable."); }
void PotentialMatchesUpdated() { //nugget: total hack... DataGrid's don't AutoGenerate columns if there aren't any rows in the initial ItemsSource... that's pretty bogus if you ask me, DataTable's/DataView's can obviously have columns even if they don't have rows yet //so i've currently found no cleaner way than this ugly code which twiddles the ItemsSource enough to wake the DataGrid back up to AutoGeneate it's columns //... this spooks me out ... i guess every other DataGrid has always been fed some initial rows that hold this house of cards together, wild //nugget: there is something about the underlying approach where the bound DataGrid was tough to get to populate // not just the AutogenerateColumns but even the rows wouldn't fill in unless i reassigned the ItemsSource // my best guess is that it's because the PotentialClientMatches backing table gets updated on a background thread // i thought it was a recommended approach to fill the bound ItemsSource however (background or not) and expect the UI to auto refresh gridMatches.ItemsSource = null; gridMatches.ItemsSource = Sponsor.PotentialClientMatches; //if we weren't already popped open, do the bounce if (Sponsor.PotentialClientMatches.Count > 0) { MatchesColumn.GridSplitterOpeningBounce(true, 300); } }