<datagrid name="dgSales" height="300" margin="0,3,0,0" issynchronizedwithcurrentitem="True" selecteditem="{Binding SelectedItem,Converter={StaticResource ignoreNewItemPlaceHolderConverter}}" itemssource="{Binding StockList,UpdateSourceTrigger=PropertyChanged}" tooltip="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors)[0].ErrorContent}" gotkeyboardfocus="dgSales_GotKeyboardFocus" currentcellchanged="dgSales_CurrentCellChanged" previewkeydown="dgSales_PreviewKeyDown">
<datagrid.columns>
<datagridtextcolumn header="S No." width="SizeToCells" minwidth="60" binding="{Binding SNo}" isreadonly="True" />
<datagridtemplatecolumn header="Stock Name" width="280">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<textblock text="{Binding StockName}" />
</datatemplate>
</datagridtemplatecolumn.celltemplate>
<datagridtemplatecolumn.celleditingtemplate>
<datatemplate>
<combobox width="280" name="cmbStock" itemssource="{Binding Path=Stocks}" focusmanager.focusedelement="{Binding RelativeSource={RelativeSource Self}}"></combobox>
</datatemplate>
</datagridtemplatecolumn.celleditingtemplate>
</datagridtemplatecolumn>
<datagridtextcolumn header="Unit Price" width="SizeToCells" minwidth="80" binding="{Binding UnitPrice,UpdateSourceTrigger=LostFocus}" />
<datagridtextcolumn header="Unit" width="SizeToCells" minwidth="80" binding="{Binding Unit}" isreadonly="True" />
<datagridtextcolumn header="Quantity" width="SizeToCells" minwidth="80" binding="{Binding Quantity,UpdateSourceTrigger=LostFocus}" />
<datagridtextcolumn header="Discount" width="SizeToCells" minwidth="80" binding="{Binding Discount,UpdateSourceTrigger=LostFocus}" />
<datagridtextcolumn header="Amount" width="SizeToCells" minwidth="100" binding="{Binding Amount,StringFormat=\{0:n2\}}" isreadonly="True" />
</datagrid.columns>
</datagrid>