Click here to Skip to main content
15,891,694 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Items in listbox Pin
venugopalm1-Nov-10 18:55
venugopalm1-Nov-10 18:55 
GeneralRe: Items in listbox Pin
CrafterIt9-Nov-10 22:57
CrafterIt9-Nov-10 22:57 
GeneralRe: Items in listbox Pin
venugopalm10-Nov-10 1:33
venugopalm10-Nov-10 1:33 
GeneralRe: Items in listbox Pin
CrafterIt10-Nov-10 2:20
CrafterIt10-Nov-10 2:20 
GeneralRe: Items in listbox Pin
venugopalm10-Nov-10 3:58
venugopalm10-Nov-10 3:58 
QuestionMaintain TextBox selection despite window loosing focus? Pin
FocusedWolf23-Oct-10 11:49
FocusedWolf23-Oct-10 11:49 
AnswerRe: Maintain TextBox selection despite window loosing focus? Pin
Abhinav S23-Oct-10 17:28
Abhinav S23-Oct-10 17:28 
GeneralRe: Maintain TextBox selection despite window loosing focus? [modified] Pin
FocusedWolf23-Oct-10 19:45
FocusedWolf23-Oct-10 19:45 
I figured it out. Was pretty easy lol.

Just added this to my main window to consume the WM_KILLFOCUS message, and by doing so i disabled the textbox from ever getting notified that focus for the app has been lost Big Grin | :-D

<br />
        const int WM_KILLFOCUS = 8;<br />
<br />
        protected override void OnSourceInitialized(EventArgs e)<br />
        {<br />
            base.OnSourceInitialized(e);<br />
            HwndSource source = PresentationSource.FromVisual(this) as HwndSource;<br />
            source.AddHook(WndProc);<br />
        }<br />
<br />
        IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)<br />
        {<br />
            if (msg == WM_KILLFOCUS)<br />
                handled = true;<br />
<br />
            return IntPtr.Zero;<br />
        }<br />


Additionally, i also subscribed to the TextBox's LostFocus event in order to prevent the textbox from losing focus to another control, which would also result in the TextBox loosing the selection highlighting.

<br />
private void textBoxReadingMaterial_LostFocus(object sender, RoutedEventArgs e)<br />
{<br />
            e.Handled = true; //prevents selection from being lost<br />
}<br />

modified on Sunday, October 24, 2010 1:54 AM

GeneralRe: Maintain TextBox selection despite window loosing focus? Pin
Abhinav S23-Oct-10 22:32
Abhinav S23-Oct-10 22:32 
GeneralRe: Maintain TextBox selection despite window loosing focus? Pin
Pete O'Hanlon25-Oct-10 5:12
mvePete O'Hanlon25-Oct-10 5:12 
GeneralRe: Maintain TextBox selection despite window loosing focus? [modified] Pin
FocusedWolf26-Oct-10 11:26
FocusedWolf26-Oct-10 11:26 
QuestionWPF TreeView MultiBinding Pin
Valentine Vlasov23-Oct-10 6:47
Valentine Vlasov23-Oct-10 6:47 
QuestionHow can I load gridview using ria service in MVVM ? Pin
kimo code23-Oct-10 3:06
kimo code23-Oct-10 3:06 
QuestionOpion Poll: Pin
ProtoBytes22-Oct-10 11:05
ProtoBytes22-Oct-10 11:05 
QuestionHas any one seen a good video series on the complete proess of going from SketchFlow ProtoType -> Application? Pin
ProtoBytes22-Oct-10 11:02
ProtoBytes22-Oct-10 11:02 
QuestionI should know the answer to this question, how do you create writeablebitmap images in WPF / Silverlight 4 Pin
ProtoBytes22-Oct-10 10:57
ProtoBytes22-Oct-10 10:57 
QuestionI am using Blend Studio 4 - Designer, where is the GPU acceleration? Pin
ProtoBytes22-Oct-10 10:45
ProtoBytes22-Oct-10 10:45 
QuestionSilver Light / WPF .NET 4.0 Pin
ProtoBytes22-Oct-10 10:38
ProtoBytes22-Oct-10 10:38 
QuestionHow using dataform and WCF Pin
Coban_22-Oct-10 2:56
Coban_22-Oct-10 2:56 
AnswerRe: How using dataform and WCF Pin
Abhinav S23-Oct-10 17:57
Abhinav S23-Oct-10 17:57 
QuestionProblem consuming a WCF service + Silverlight 4 Pin
CrafterIt22-Oct-10 2:01
CrafterIt22-Oct-10 2:01 
AnswerRe: Problem consuming a WCF service + Silverlight 4 Pin
SledgeHammer0122-Oct-10 6:41
SledgeHammer0122-Oct-10 6:41 
GeneralRe: Problem consuming a WCF service + Silverlight 4 Pin
CrafterIt26-Oct-10 3:17
CrafterIt26-Oct-10 3:17 
QuestionAssign Datagrid Value From Child Web Page To A Textbox In Parent Webform by silverlight Pin
ya_yayeeh21-Oct-10 22:44
ya_yayeeh21-Oct-10 22:44 
QuestionRowDetailsTemplate - Can't Edit Data [modified] Pin
eddieangel21-Oct-10 14:27
eddieangel21-Oct-10 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.