Posted 16 years ago
by Derek Smithson
-
Software Developer,
Vista Systems, Corp.

I'm using the WPF ribbon control in my application (version 4.0.0457 of the WPF Suite), and I've noticed that a datasource bound to the Text property of the Textbgox may or may not be updated depending on the action a user takes to release focus of the TextBox control.
The binding source is updated properly when:
<ribbon:TextBox Width="100" Label="Name" Text="{Binding Path=Name}" />
- Tabbing out of text control after making text changes
- Pressing enter after making text changes
- Clicking another control with the mouse after making changes to text
private void TextBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
ActiproSoftware.Windows.Controls.Ribbon.Controls.TextBox ribbonBox = sender as ActiproSoftware.Windows.Controls.Ribbon.Controls.TextBox;
if (ribbonBox != null)
{
DependencyProperty textProp = ActiproSoftware.Windows.Controls.Ribbon.Controls.TextBox.TextProperty;
BindingExpression binding = ribbonBox.GetBindingExpression(textProp);
if (binding != null)
binding.UpdateSource();
}
}