WPF DataGrid Binding on Columns -


hope wasn't asked already, can't find answer. got viewmodel set datacontext in xaml. in viewmodel list< dealer>-property. dealer has properties should displayed in datagrid (as columns, not of them). tried implement this:

<grid x:name="mygrid" datacontext="{binding source={staticresource creategamevm}}"> ...    <datagrid name="dealerlist" autogeneratecolumns="false" itemssource="dealerlist">       <datagrid.columns>          <datagridtextcolumn header="id" width="30"  binding="{dealerid}" />                                  <datagridtextcolumn header="name" width="*" binding="{dealername}" />                              </datagrid.columns>    </datagrid> ... </grid> 

in case propertychanged in viewmodel null, nothing updated when dealerlist changes. (but items in dealerlist, before setting datacontext displayed correctly). don't know how solve this.

bind observablecollection<dealer> on viewmodel instead. way automatically updated when collection changes.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -