Windows Forms FAQ

Syncfusion WPF FAQ

Welcome to the WPF FAQ. Questions and answers in this FAQ have been collected from newsgroup posts, various mailing lists and the employees of Syncfusion. If you have a FAQ, or any other good WPF resource, please email us.

Search Help
 

General

  • General
  • Concepts

  • Element Tree
  • Dependency Property
  • Attached Property
  • Resources.
  • Freezable Object
  • Input and Commands.
  • Layouts
  • XAML

  • Styles and Templates
  • XML Namespaces
  • Code Behind
  • Type Converters
  • Content Model

  • ItemControl
  • HeaderedItemsControl
  • HeaderedContentControl
  • Content Control
  • Decorator Content Model
  • Panel Content Model
  • Documents

  • Serialization and Storage
  • Annotations
  • Flow Content
  • Printing
  • Graphics and Animation

  • Rendering Graphics
  • 2D Graphics
  • 3D Graphics
  • Visual Layer
  • Animation
  • Control Customization

  • Adorners
  • Stylable controls
  • ControlTemplates
  • Data

  • Data Binding
  • DragandDrop
  • Serialization
  • Globalization and Localization

  • Attributes
  • Comments
  • Globalization Struc
  • Application and Deployment

  • ClickOnce
  • Frame
  • Page
  • Navigation
  • Setup
  • Window
  • Interoperability

  • Message Loops Between
  • Win32 in WPF
  • WPF in Win32
  • Windows Forms and WPF
  • Security

  • Trusted Security
  • Partial Trust Security
  • Tools

  • Microsoft Expression Blend
  • ZAM3D
  • XAMLPAD
  • Controls

  • ToolTip
  • StatusBar
  • Context Menu
  • Expander
  • DocumentViewer
  • TreeView
  • GroupBox
  • GridSplitter
  • Image
  • Menu
  • Slider
  • RichTextBox
  • ProgressBar
  • Popup
  • TextBox
  • TextBlock
  • TabControl
  • Border
  • Buttons
  • Canvas
  • ComboBox
  • ListBox
  • 1. General

      

       1.1What is WPF?
       1.2What is XAML?
       1.3What is XBAP?

    2. Concepts Element Tree

      

       2.1How can I enumerate all the descendants of a visual object ?
       2.2How can I override the Logical Tree ?

    3. Concepts Dependency Property

      

       3.1How can I create Custom Read-Only Dependency Properties ?
       3.2How can I set an attached property in code?
       3.3How can I mark the default value of a custom dependency property to be false?

    4. Concepts Attached Property

      

    5. Concepts Resources.

      

       5.1How can I use an application resource ?

    6. Concepts Freezable Object

      

       6.1How can I determine whether a Freezable Is Frozen?
       6.2How can I obtain a writable copy of a Read-Only Freezable?

    7. Concepts Input and Commands.

      

       7.1What built-in commands are defined in the WPF framework?
       7.2How can I add a CommandBinding to a window using markup?

    8. Concepts Layouts

      

       8.1When I try to add multiple controls to a button it shows an error, how do I add multiple controls to a button?

    9. XAML Styles and Templates

      

       9.1How can I restrict the use of style for certain types of controls ?
       9.2How can I create an extended style ?
       9.3How can I set a ControlTemplate ?
       9.4How can I create a custom WPF button whose look and feel depends on the Windows desktop theme currently in use. How do I get notified when the user changes the theme?
       9.5What are the limitations of Inline Styles and Templates ?
       9.6How do I see the templates used by the WPF framework controls?

    10. XAML XML Namespaces

      

       10.1How can I map CLR Namespaces to XML Namespaces in an Assembly ?
       10.2Which namespace is used to associate namespace identifiers with element names ? Is there any effect on the attributes ?

    11. XAML Code Behind

      

       11.1What is the use of x:code ?

    12. XAML Type Converters

      

       12.1How can I apply the TypeConverter Attribute?

    13. Content Model ItemControl

      

       13.1How can I create Four Button controls with the contents set to a String, a DateTimeObject, an UIElement and A Panel that contains other UIElement objects?
       13.2Can I create a ContentTemplate and apply the template to a ContentControl ?

    14. Content Model HeaderedItemsControl

      

       14.1How can I create a ControlTemplate for a HeaderedItemsControl ?

    15. Content Model HeaderedContentControl

      

    16. Content Model Content Control

      

       16.1How can I make a style for a ContentControl so that the control has an enhanced visual appearance ?
       16.2How can I get an enumerator to the ContentControl's logical child elements ?

    17. Content Model Decorator Content Model

      

       17.1How do I create a Borderless Window in WPF ?
       17.2How can I animate a BorderThickness value ?

    18. Content Model Panel Content Model

      

       18.1How do I add controls to "Panel Content Model" type of controls in code?

    19. Documents Serialization and Storage

      

       19.1How can I store a given document in a specific format using CreateSerializerWriter methods ?
       19.2How can I use MemoryStream to create a deep clone of a serializable object ?
       19.3How can I do versioning using Custom Serialization ?

    20. Documents Annotations

      

       20.1How can I Match Annotations with Annotated Objects ?
       20.2How can I create an application that is used to declare a Context Menu with routed commands that the users can access to create and manage annotations ?

    21. Documents Flow Content

      

       21.1How can I load an XAML file into a FlowDocumentReader?
       21.2How can I save the contents of a FlowDocumentReader as an XAML file ?
       21.3How can I store a given document in a specific format using CreateSerializerWriter methods ?
       21.4How do I load a FlowDocument XAML content from outside the application directory?
       21.5How can I define three paragraphs under one section ?
       21.6How can I use the BlockUIContainer element to host UIElement objects within Flow content ?
       21.7Can I embed a figure into a paragraph of text ?

    22. Documents Printing

      

       22.1How can I programmatically print XPS Files ?

    23. Graphics and Animation Rendering Graphics

      

       23.1How rendering in WPF differs from WIN32 applications?
       23.2How can I use a DoubleAnimation to rotate the textblock ?
       23.3How can I create a combined hard and soft shadow ?

    24. Graphics and Animation 2D Graphics

      

       24.1How do I apply BitmapEffect to a particular area of an Image ?

    25. Graphics and Animation 3D Graphics

      

       25.1What are the properties that reduce the performance of 3D graphics rendering?
       25.2How lights are useful in 3D graphics ?

    26. Graphics and Animation Visual Layer

      

       26.1How HitTest methods in VisualTreeHelper is useful ?

    27. Graphics and Animation Animation

      

       27.1At the end of animation, how do I cause the value of a property to revert back to it's original value?
       27.2Performance gets reduced even after navigating away from a page that contains animation. How do we handle this issue ?
       27.3How do I apply an animation without using a storyboard ?
       27.4What are the requirements for a property to be animated?
       27.5How do I trigger an animation when the data in the control is changed?
       27.6How do I control a Storyboard animation once it starts?
       27.7I have a sequence of animations I want to execute one after another, how do I do that?

    28. Control Customization Adorners

      

       28.1What is an adorner ?
       28.2Where can adorners be used ?
       28.3How to add a custom adorner ?
       28.4How do I bind an Adorner to an Element ?
       28.5How do I remove the Adorner from an element ?

    29. Control Customization Stylable controls

      

       29.1Where can I find information about guidelines to be followed while designing Stylable controls?
       29.2What are the different models for Control authoring ?

    30. Control Customization ControlTemplates

      

       30.1What is the use of a ControlTemplate ?
       30.2How to access elements that are embedded inside the ControlTemplate ?
       30.3How do I build an ItemsControl ControlTemplate ?
       30.4How to edit templates using Microsoft Expression Blend ?
       30.5How to get the default template of a control programmatically ?

    31. Data Data Binding

      

       31.1What is DataContext ? How is it used ?
       31.2What is the use of the RelativeSource property ?
       31.3What are the uses of BindingModes?
       31.4How does TwoWay BindingMode work in an XMLDataProvider?
       31.5Can ItemsControl's Items and ItemsSource properties be modified simultaneously ?
       31.6How do I apply custom sorting to the order of the items in a bound listbox?
       31.7How do I update the source as I type in a TextBox?
       31.8When an XMLDataProvider can be used ? What are it's specific uses ?
       31.9In what way is an ObjectDataProvider useful?
       31.10How to pass a parameter to a constructor using ObjectDataProvider ?
       31.11How to pass a parameter to a function using ObjectDataProvider ?
       31.12How can I bind a method and pass a parameter to the method ?
       31.13How to Get or Set a value that indicates whether to include the DataErrorValidationRule ?

    32. Data DragandDrop

      

       32.1What are the objects involved in DragandDrop?
       32.2How do I create a DataObject?
       32.3How do I retrieve data from a DataObject ?

    33. Data Serialization

      

       33.1What is Serialization ?
       33.2How to write some XML into IsolatedStorage?
       33.3How do I serialize objects to a binary file ?

    34. Globalization and Localization Attributes

      

       34.1What are the three types of Localizability Attributes and how to use them ?
       34.2How can I set the Language property to the current user's UI language ?
       34.3How can I set the substitution property by overriding the default substitution ?

    35. Globalization and Localization Comments

      

       35.1How can I add localization comments to an XAML file ?
       35.2How can I specify in the .proj file whether to leave the free-form localization comments in the assembly or strip them out ?

    36. Globalization and Localization Globalization Struc

      

       36.1How can I automatically layout Grids Using the IsSharedSizeScope Property ?

    37. Application and Deployment ClickOnce

      

       37.1How does ClickOnce deployment work ?
       37.2Can I add prerequisites in my ClickOnce deployment ?
       37.3How do I enable automatic updates for my application using ClickOnce deployment ?

    38. Application and Deployment Frame

      

       38.1What is the difference between Frame and NavigationWindow ?
       38.2How does Rendering work in Frame control ?
       38.3Can I add dynamic HTML content to a Frame control ?

    39. Application and Deployment Page

      

       39.1Are XAML Browser Applications OS independent ?
       39.2When I run an XBAP application, I get Application Deployment Error. What do I do to overcome this error ?
       39.3How to navigate between pages in an application ?

    40. Application and Deployment Navigation

      

       40.1How to set content of a NavigationWindow ?
       40.2How do I handle Back and Forward button click ?
       40.3How do I pass data between pages in a NavigationWindow ?

    41. Application and Deployment Setup

      

       41.1How do I add registry entries in a setup project ?
       41.2How do I deploy shared components ?
       41.3How launch conditions are useful and how to add one to a setup project ?

    42. Application and Deployment Window

      

       42.1How do I create a child window in WPF ?
       42.2How do I host Windows Forms control in a WPF Window ?
       42.3Does WPF support MDI ?
       42.4How do I load a Window from a XAML file dynamically?

    43. Interoperability Message Loops Between

      

       43.1How can I HwndSource Treats ComponentDispatcher Events ?

    44. Interoperability Win32 in WPF

      

       44.1How do I host a Windows Forms control in a WPF application ?

    45. Interoperability WPF in Win32

      

       45.1How do I host a WPF control in a Windows Forms application?
       45.2How can I Host the WPF UserControl in Windows Forms ?
       45.3What is the procedure to host the WPF content in Win32 window ?
       45.4How can I leverage my current investment in Windows Forms applications and still tap into the cool features of WPF ?

    46. Interoperability Windows Forms and WPF

      

       46.1What about hosting user controls and third-party controls including ActiveX controls in a WPF Form?
       46.2Where do I find System.Windows.Forms.Integration ?
       46.3How can I use a WindowsFormsHost element to host a System.Windows.Forms ?

    47. Security Trusted Security

      

       47.1How do I assign full trust to an XBAP application ?
       47.2I am able to access the registry using full trust XBAP application in debug mode, when hosted in an intranet, the application crashes. What do I do?
       47.3How do I get a custom defined permission set of an XBAP application ?

    48. Security Partial Trust Security

      

       48.1How to get data from database in XBAP application ?
       48.2Does permission set of partial trust change in the Local Intranet and Internet?
       48.3How do I detect permission for a file in a partial trust application ?

    49. Tools Microsoft Expression Blend

      

       49.1Can a WPF application be designed using Microsoft Expression Blend ?
       49.2How do I add animations using Microsoft Expression Blend ?
       49.3How do I add custom controls to an application using Microsoft Expression Blend ?

    50. Tools ZAM3D

      

       50.1What is ZAM3D ?
       50.2What are the file formats supported by ZAM3D ?
       50.3Can an XAML file created using ZAM3D be used with Visual Studio.NET ?

    51. Tools XAMLPAD

      

       51.1What is XAMLPAD ?
       51.2Does XAMLPAD support custom controls ?
       51.3Can we see the output of an XAML using XAMLPAD ?

    52. Controls ToolTip

      

       52.1How do I customize the style of a tooltip that gets shown ONLY on the CheckBoxes in my Window?
       52.2How do I use the TooltipService class?
       52.3Can I delay the display of a ToolTip ?
       52.4How do I include a delay only for the first tooltip and not for subsequent tooltips in my app?
       52.5How come I don't see a MouseHover event in WPF for it's elements?

    53. Controls StatusBar

      

       53.1How do I create custom layout for StatusBar items?

    54. Controls Context Menu

      

       54.1How do I listen to click events on all the MenuItems through the parent ContextMenu?
       54.2How can I enable a Context Menu on a disabled Control ?

    55. Controls Expander

      

       55.1How can I create an Expander with a ScrollViewer ?

    56. Controls DocumentViewer

      

       56.1How can I extend the style of a DocumentViewer ?
       56.2How can I reflect via data binding the current Zoom value of a DocumentViewer in a TextBlock?
       56.3How to load an XPS document into the DocumentViewer?

    57. Controls TreeView

      

       57.1How do I bind my tree to a hierarchical list?
       57.2I have a custom type called Group which has 2 collections Products and Services and I want both these collections to appear as siblings when the Groups collection is bound to a tree, how do I do that?
       57.3How do I bind a flat table/list containing self-referencing data to a TreeView to render it in a hierarchical view?
       57.4How do I listen to click events on all the tree nodes through the parent tree?

    58. Controls GroupBox

      

    59. Controls GridSplitter

      

       59.1How can I make sure that a GridSplitter Is visible ?

    60. Controls Image

      

       60.1How can I convert an Image to grayscale ?
       60.2How to rotate an image ?
       60.3How do I access / edit the metadata associated with an Image ?
       60.4How can I stamp some text on an image?

    61. Controls Menu

      

       61.1How can I style a Separator used as a Menu Item ?

    62. Controls Slider

      

       62.1How can I customize the Ticks on a Slider ?

    63. Controls RichTextBox

      

       63.1How can I Save, Load, and Print RichTextBox Content ?
       63.2How to get the RichTextBox's unformatted text?

    64. Controls ProgressBar

      

       64.1How can I create a ProgressBar and use an animation to simulate the progress of an operation ?
       64.2How can I set the text as "Completed" in a progress bar at the end of progress?

    65. Controls Popup

      

       65.1How can I animate a Popup ?

    66. Controls TextBox

      

       66.1How do I make a TextBox use all upper-case (or lower-case) characters ?
       66.2How do I support browsing for a text file and reading it into a TextBox?
       66.3How do I hide the default context menu of the TextBox?

    67. Controls TextBlock

      

       67.1How do I embed a Button into a TextBox?
       67.2How do I bind a TextBlock to a resource string defined in the application's resource1.resx file?

    68. Controls TabControl

      

       68.1How do I validate the current tab before selection changes to another tab on user click?
       68.2How do I dynamically hide and unhide tabs in a TabControl ?
       68.3How do I make the tabs in a TabControl appear on the bottom instead of on top?
       68.4How can I add a style to a TabItem that is used in the TabControl ?
       68.5How do I get a X in my tabs to allow the user to close certain tabs, as in IE?

    69. Controls Border

      

       69.1How can I animate the thickness of a border by using ThicknessAnimation ?
       69.2How can I use a BulletDecorator control that uses an image as the Bullet and a non-text element as the Child ?

    70. Controls Buttons

      

       70.1How do I change the shape of the button to an ellipse?

    71. Controls Canvas

      

       71.1How can I use the attached properties of Canvas to position child elements ?
       71.2How do I position the children of a Canvas at a discreet X but stretch them vertically to fill?

    72. Controls ComboBox

      

       72.1What are the data sources I can bind the ComboBox's list to?
       72.2How do I bind the values of an enum to a ComboBox ?
       72.3How do I listen to text changed events in a ComboBox in editable mode?
       72.4How do I fill a ComboBox with the available fonts ?

    73. Controls ListBox

      

       73.1What are the data sources I can bind the ListBox to?
       73.2How do I make the ListBox display the value of a property instead of the type name of the objects in my list?
       73.3How do I bind the ListBox to a collection Property in my Window?
       73.4How do I bind a string array with a ListBox?
       73.5How do I display items in a ListBox horizontally?
       73.6How do I change the background of the selected item in the ListBox?
       73.7Why does the selection stay grayed out after I change the selection in the ListBox in the click of a button?

    © 2001-2008 Copyright Syncfusion Inc. All rights reserved.  |  Privacy Policy  |  Contact  |  Sitemap