I dont know how I implement one special behaviour. I have a view with a datagrid which includes two columns. One column displays a formated price ("00.00"). The price will automatically saved, when the binding is updated (property is set). If I use UpdateSourceTrigger=PropertyChanged, the price is always correct. The drawback of this trigger is, that if a user selects all text in the textbox and type just "1", the price will formated to "01.00". I dont want the price automatically formated. That formatting should only appear, when the focus is moved to an other object.
In theory I need to set two different UpdateSourceTrigger. One for updating the backend (The user types something into the textbox). And one for updating the target (the focus moved to an other object). In addition I need to immediatly display, if the new value is invalid.
<DataGrid>
<DataGrid.Columns>
<!-- one other column -->
<DataGridTemplateColumn Header="Price"/>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!-- this textbox should update the source if user types something -->
<!-- the textbox itself should be updated after lost focus -->
<TextBox Text="{Binding Price, UpdateSourceTriger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn/>
</DataGrid.Column>
</DataGrid>
EDIT: I will give you a small example: if I set the bound Price property to "1", it will automatically formated to "01.00". With a UpdateSourceTrigger=PropertyChanged, the TextBox displays "01.00". I want that the TextBox display the "1" as long as the TextBox is focused. Of course I would get that behaviour with UpdateSourceTrigger=LostFocus. The problem here is, that the DataGrid is contained in a TabControll and both controls dont act very well together. If you select an other tab while the focus is still on the TextBox, there will be no LostFocus thrown by the TextBox.
Hope some of you have an advice for me :-)
André