المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : canvas.Focus does not unfocus textbox



C# Programming
04-21-2009, 11:51 AM
Hi,

I have kind of a drawingprogram. I display an image in a canvas and on that canvas with image the user can place multiple custom controls (drawing area's derived from the canvas class) in which the user can draw figures and text. To input the text, I initialize a textbox. When clicking outside the textbox, that textbox must disappear and the text is shown as formatted text (drawingContext.draw) on the control. I do that with textBox.LostFocus and textBox.LostKeyboardFocus.

Problem is that when I click outside the textbox, the textbox does not lose focus! When clicking on the canvas, I use this.focus(). The code when clicking the canvas is called and it passes the focus command but the textbox does not lose focus.

The code to hide the textbox and display the text as formatted text works.

Anybody has an idea? Maybe I missed something in MSDN that I need to do.

Thanks,
Bart