Hello, the first problem is caused by an event handler in DataGrid.
private void DataGrid_KeyDown(object sender, KeyEventArgs e)
{
if (!e.Handled)
{
e.Handled = ProcessDataGridKey(e);
}
}
As you can see, DataGrid itself will handle the KeyDown event. You may want to handle the TextBox's KeyDown event and set e.Handled to true.
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
e.Handled = true;
}
}
Unfortunately this will prevent the TextBox to create a new line. Currently there's no good work around. The only solution I can think out is:
if (e.Key == Key.Enter)
{
((TextBox)sender).Text += "\n";
e.Handled =
true;
}
This will create a new line, but it will move the caret to the beginning of the TextBox. Unfortunately currently there's no way to control the caret of a TextBox...
For the second problem, it works fine for me. After the TextBox loses focus, the TextBlock is updated with the new text.
shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.