:: Home

  login:         
  passwords:  

WPF FAQs

WPF General Questions
Concepts Element Tree
Concepts Dependency Property
Concepts Attached Property
Concepts Routed Events
Concepts Resources.
Concepts Animation
Concepts Freezable Object
Concepts Input and Commands.
Concepts Layouts
XAML Inline Styles and Templates
XAML XML Namespaces
XAML Code Behind
XAML Custom Class
XAML Type Converters
Content Model ItemControl
Content Model HeaderedItemsControl
Content Model HeaderedContentControl
Content Model Content Control
Content Model Decorator Content Model
Content Model Panel Content Model
Documents Serialization and Storage
Documents Annotations
Documents Flow Content
Documents Printing
Graphics and Multimedia Rendering Graphics
Graphics and Multimedia Animation and Timing
Graphics and Multimedia 2D Graphics
Graphics and Multimedia 3D Graphics
Graphics and Multimedia Visual Layer
Control Customization Adorners
Control Customization Stylable controls
Control Customization ControlTemplates
Data Data Binding
Data DragandDrop
Data Serialization
Globalization and Localization Attributes
Globalization and Localization Comments
Globalization and Localization Globalization Struc
Application and Deployment ClickOnce
Application and Deployment Frame
Application and Deployment Page
Application and Deployment Navigation
Application and Deployment Setup
Application and Deployment Window
Interoperability Message Loops Between
Interoperability Win32 in WPF
Interoperability WPF in Win32
Interoperability Windows Forms and WPF
Security Trusted Security
Security Partial Trust Security
Tools Microsoft Expression Blend
Tools ZAM3D
Tools XAMLPAD
Controls ToolTip
Controls TextBlock
Controls TabControl
Controls ProgressBar
Controls PrintDialog
Controls Popup
Controls TextBox
Controls Canvas
Controls ComboBox
Controls ListBox
Controls StatusBar
Controls ToolBar
Controls Context Menu
Controls Expander
Controls DocumentViewer
Controls FlowDocumentReader
Controls GroupBox
Controls GridSplitter
Controls Image
Controls Menu
Controls ScrollBar
Controls Slider
Controls RichTextBox
Controls Border
Controls Buttons

SilverLight Interview Qs

SAP Interview Questions

Oracle Interview Questions

PHP Interview Questions

Ajax Interview Questions

IIS 7.0

OOP Interview Questions

Ruby Interview Questions

Sql Server Interview Questions

Winforms Interview Questions

SharePoint 2007 Questions

Microsoft Crm Questions

Interoperability Message Loops Between Interview Questions & FAQs

Questions and answers for Interoperability Message Loops Between.
 

46. Interoperability Message Loops Between

    46.1 How can I write Message Loops ?
    46.2 How can I HwndSource Treats ComponentDispatcher Events ?
    46.3 How can I set the Owner property of the WPF window to the handle of our main form using helper class ?

46.1 How can I write Message Loops ?

Message Loops can be written with the following properties.

IsThreadModal - returns whether the application has gone modal (e.g., a modal message loop has been pushed). ComponentDispatcher can track this state because the class maintains a count of "PushModal" and "PopModal" calls from the message loop.

ThreadFilterMessage and ThreadPreprocessMessage events follow the standard rules for delegate invocations. Delegates are invoked in an unspecified order and all delegates are invoked even if the first one marks the message as handled.

ThreadIdle - indicates an appropriate and efficient time to do idle processing (there are no other pending messages for the thread). ThreadIdle will not be raised if the thread is modal.

ThreadFilterMessage - raised for all messages that the message pump processes.

ThreadPreprocessMessage - raised for all messages that were not handled during ThreadFilterMessage.


46.2 How can I HwndSource Treats ComponentDispatcher Events ?

If the HwndSource is a top-level window (no parent HWND), it will register with ComponentDispatcher. If ThreadPreprocessMessage is raised and if the message is intended for the HwndSource or child windows, HwndSource calls its IkeyboardInputSink, TranslateAccelerator, TranslateChar, OnMnemonic keyboard sink sequence. If the HwndSource is not a top-level window (has a parent HWND), there will be no handling. Only the top-level window is expected to do the handling and there is expected to be a top-level window with keyboard sink support as part of any interoperation scenario.

If WndProc on an HwndSource is called without an appropriate keyboard sink method being called first, your application will receive the higher level keyboard events such as "KeyDown". However, no keyboard sink methods will be called which circumvents desirable keyboard input model features such as access key support. This might happen because the message loop did not properly notify the relevant thread on the ComponentDispatcher or because the parent HWND did not invoke the proper keyboard sink responses.

ThreadFilterMessage and ThreadPreprocessMessage events follow the standard rules for delegate invocations. Delegates are invoked in an unspecified order and all delegates are invoked even if the first one marks the message as handled.

A message that goes to the keyboard sink might not be sent to the HWND if you add hooks for that message by using the "AddHook()" method. The message might have been handled at the message pump level directly and not submitted to the DispatchMessage function.


46.3 How can I set the Owner property of the WPF window to the handle of our main form using helper class ?

Navigation in an application can be done in a pre-determined linear sequence, a user driven path through hierarchy or a dynamically generated path.

Navigation can be performed using the following methods:

  • Using Navigate method

Navigate method in the Navigation service can be used to navigate to a page in the application.

[C#]

//Navigate using URI.
this.NavigationService.Navigate(new Uri("mypage.xaml", UriKind.Relative));

//Navigate to an instance of a page.
mypage newpage = new mypage();
this.NavigationService.Navigate(newpage);

Using Hyperlinks

"NavigateUri" property of Hyperlink markup extension can be used to open a page using hyperlink.

[XAML]

<TextBlock>

     <Hyperlink NavigateUri="mypage.xaml">New Page</Hyperlink>

</TextBlock>


  • Using the journal

Both navigation containers have a journal that records navigation history like a web browser. The journal maintains two stacks for 'Back' and 'Forward' stacks to record navigation.

bottom user control
::  Home :: Services ::  Prices ::  Request Quote
Copyright 2007, Megasolutions Ltd