|
|
|
Welcome to WPF (Windows Presentation Foundation ) FAQs and Interview Quesitons
and Answers section. The Windows Presentation Foundation Interview
Questionslisted below have been collected through various forums, websites,
blogs and other resources. We have included the references to the originators
where we can but if you feel that you should be credited for a given problem
please contact us.
If you have a product or service that you would like to be included in the FAQ
section, please contact us at FAQs@megasolutions.net
|
|
|
| 1.1 What is
WPF?
|
| 1.2 What is
XAML?
|
| 1.3 What is
XBAP?
|
|
|
| 2.1 How can I
override the Logical Tree ?
|
| 2.2 How can I
enumerate all the descendants of a visual object ?
|
|
|
| 3.1 How can
I create Custom Read-Only Dependency Properties ?
|
| 3.2 How can
I use Dependency Property MetaData?
|
| 3.3 How
can I register the default value of the State dependency property to be false?
|
|
|
| 4.1 What is
Attached Properties and how to register it?
|
| 4.2 How can I
set an attached property in code?
|
|
|
| 5.1 What is a
Routed event?
|
| 5.2 How can I
handle the input event through XAML?
|
|
|
| 6.1 How can I use an
application resource ?
|
|
|
| 7.1 What are the
requirements for a property to be animated?
|
| 7.2 How do I trigger
an animation when the data in the control is changed?
|
| 7.3 What is Path
animation?
|
|
|
| 8.1 What is a
Freezable?
|
| 8.2 How can I
determine whether a Freezable Is Frozen?
|
| 8.3 How can I
obtain a writable copy of a Read-Only Freezable?
|
|
|
| 9.1 What is
Commanding in WPF?
|
| 9.2 How do I
create a CommandBinding using a RoutedCommand?
|
| 9.3 How can I add
a CommandBinding to a window using markup?
|
|
|
| 10.1 When I try to add
multiple controls to a button it shows an error, how do I add multiple controls
to a button?
|
| 10.2 How placing
controls in a WrapPanel differs from a Grid?
|
|
|
| 11.1 How
can I restrict the use of style ?
|
| 11.2 How
can I create an extended style ?
|
| 11.3 How
can I set a ControlTemplate ?
|
| 11.4 How
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?
|
| 11.5 What
are the limitations of Inline Styles and Templates ?
|
|
|
| 12.1 How can I map
CLR Namespaces to XML Namespaces in an Assembly ?
|
| 12.2 Which namespace
is used to associate namespace identifiers with element names ? Is there any
effect on the attributes ?
|
|
|
| 13.1 What is the use of
x:code ?
|
|
|
| 14.1 What way can a
custom class can be defined in XAML?
|
|
|
| 15.1 How can I
apply the TypeConverter Attribute?
|
|
|
| 16.1 How 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?
|
| 16.2 Can I create
a ContentTemplate and apply the template to a ContentControl ?
|
|
|
| 17.1 How
can I create a ControlTemplate for a HeaderedItemsControl ?
|
|
|
| 18.1 How
can I make a style for a ContentControl so that the control has an enhanced
visual appearance ?
|
|
|
| 19.1 How can I
get an enumerator to the ContentControl's logical child elements ?
|
|
|
| 20.1 How
do I create a Borderless Window in WPF ?
|
| 20.2 How
can I animate a BorderThickness value ?
|
| 20.3 How
can I use Event Trigger to control a StoryBoard after it is started ?
|
|
|
| 21.1 How
do I add controls to Panel Content Model type of controls?
|
|
|
22.1 How
can I store a given document in a specific format using CreateSerializerWriter
methods ?
|
| 22.2 How
can I use MemoryStream to create a deep clone of a serializable object ?
|
| 22.3 How
can I do versioning using Custom Serialization ?
|
|
|
| 23.1 How can I Match
Annotations with Annotated Objects ?
|
| 23.2 How 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 ?
|
|
|
| 24.1 How can I
define three paragraphs under one section ?
|
| 24.2 How can I use
the BlockUIContainer element to host UIElement objects within Flow content ?
|
| 24.3 Can I embed a
figure into a paragraph of text ?
|
|
|
| 25.1 How can I
programmatically print XPS Files ?
|
|
|
| 26.1
How can I create a combine hard and soft shadow ?
|
| 26.2
How can I use a DoubleAnimation to rotate the textblock ?
|
| 26.3
What is the order in which the controls are rendered ?
|
| 26.4
How do I enumerate child objects in a visual tree ?
|
| 26.5
How rendering in WPF differs from WIN32 applications?
|
|
|
| 27.1
When an animation is applied, the property value gets overwritten. How do we
prevent the value of property ?
|
| 27.2
Performance gets reduced even after navigating away from a page that contains
animation. How do we handle this issue ?
|
| 27.3
How do I apply an animation without using a storyboard ?
|
|
|
| 28.1 How
do I apply BitmapEffect to a particular area of an Image ?
|
| 28.2 How
do I apply Transform when an event is occurred ?
|
| 28.3 In
what way CombinedGeometry is used ?
|
|
|
| 29.1 What are
the properties that reduce the performance of a 3D graphics ?
|
| 29.2 How
lights are useful in 3D graphics ?
|
| 29.3 How do I
change the location of a model ?
|
|
|
| 30.1 How
HitTest methods in VisualTreeHelper is useful ?
|
| 30.2 How
do I use DrawingVisual object ?
|
|
|
| 31.1 What is
an adorner ?
|
| 31.2 Where
can adorners be used ?
|
| 31.3 How to
add a custom adorner ?
|
| 31.4 How do I
bind an Adorner to an Element ?
|
| 31.5 How do I
remove the Adorner from an element ?
|
|
|
| 32.1
Where can I find information about guidelines to be followed while designing
Stylable controls?
|
| 32.2
What are the different models for Control authoring ?
|
|
|
| 33.1
What is the use of a ControlTemplate ?
|
| 33.2
How to access elements that are embedded inside the ControlTemplate ?
|
| 33.3
How do I build an ItemsControl ControlTemplate ?
|
| 33.4
How to edit templates using Microsoft Expression Blend ?
|
| 33.5
How to get the default template of a control programmatically ?
|
|
|
| 34.1 How to use
binding in XAML ?
|
| 34.2 What is the use
of the RelativeSource property ?
|
| 34.3 What is
DataContext ? How is it used ?
|
| 34.4 Can ItemControl's
Items and ItemsSource properties be modified simultaneously ?
|
| 34.5 How do I filter
Items in an ItemControl when the ItemControl's ItemsSource is set to a
datasource?
|
| 34.6 What are the uses
of BindingModes?
|
| 34.7 How do I update
the source as I type in a TextBox?
|
| 34.8 When an
XMLDataProvider can be used ? What are it's specific uses ?
|
| 34.9 How does TwoWay
BindingMode work in an XMLDataProvider?
|
| 34.10 In what way is
an ObjectDataProvider useful?
|
| 34.11 How to pass a
parameter to a constructor using ObjectDataProvider ?
|
| 34.12 How to pass a
parameter to a function using ObjectDataProvider ?
|
| 34.13 How can I bind
a method and pass a parameter to the method ?
|
| 34.14 How to Get or
Set a value that indicates whether to include the DataErrorValidationRule ?
|
|
|
| 35.1 What are the
objects involved in DragandDrop?
|
| 35.2 How do I create a
DataObject?
|
| 35.3 How do I retrieve
data from a DataObject ?
|
|
|
| 36.1 What is
Serialization ?
|
| 36.2 How to write an
IsolatedStorage to an XML file ?
|
| 36.3 How do I
serialize objects to a binary file ?
|
|
|
| 37.1
What are the three types of Localizability Attributes and how to use them ?
|
| 37.2
How can I set the Language property to the current user's UI language ?
|
| 37.3
How can I set the substitution property by overriding the default substitution
?
|
|
|
| 38.1
How can I specify in the .proj file whether to leave the free-form localization
comments in the assembly using LocalizationDirectivesToLocFile tag ?
|
| 38.2
How can I add localization comments to an XAML file ?
|
|
|
| 39.1
Can I override the default categories for platform controls in XAML as well ?
|
| 39.2
How can I automatically layout Grids Using the IsSharedSizeScope Property ?
|
|
|
| 40.1
How does ClickOnce deployment work ?
|
| 40.2
Can I add prerequisites in my ClickOnce deployment ?
|
| 40.3
How do I enable automatic updates for my application using ClickOnce deployment
?
|
|
|
| 41.1 What
is the difference between Frame and NavigationWindow ?
|
| 41.2 How
does Rendering work in Frame control ?
|
| 41.3 Can
I add dynamic HTML content to a Frame control ?
|
|
|
| 42.1 Are
XAML Browser Applications OS independent ?
|
| 42.2 When
I run an XBAP application, I get Application Deployment Error. What do I do to
overcome this error ?
|
| 42.3 How
to navigate between pages in an application ?
|
|
|
| 43.1
How to set content of a NavigationWindow ?
|
| 43.2
How do I handle Back and Forward button click ?
|
| 43.3
How do I pass data between pages in a NavigationWindow ?
|
|
|
| 44.1 How
do I add registry entries in a setup project ?
|
| 44.2 How
do I deploy shared components ?
|
| 44.3 How
launch conditions are useful and how to add one to a setup project ?
|
|
|
| 45.1 How
do I create a child window in WPF ?
|
| 45.2 How
do I host Windows Forms control in a WPF Window ?
|
| 45.3 Does
WPF support MDI ?
|
|
|
| 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 ?
|
|
|
| 47.1 How
can I use Windows Forms in a WPF application ?
|
| 47.2 How do
I host a Windows Forms control in a WPF application ?
|
| 47.3 How
can I leverage my current investment in Windows Forms applications and still
tap into the cool features of WPF ?
|
| 47.4 How
can I host a Windows Forms Composite Control in Windows Presentation Foundation
?
|
|
|
| 48.1 How do
I host a WPF control in a Windows Forms application?
|
| 48.2 How
can I Host the WPF UserControl in Windows Forms ?
|
| 48.3 What
is the procedure to host the WPF content in Win32 window ?
|
|
|
| 49.1
Will you provide a tool to convert Windows Forms applications to WPF
applications ?
|
| 49.2
What about user controls and third-party controls including ActiveX controls?
|
| 49.3
Where do I find System.Windows.Forms.Integration ?
|
| 49.4
Can I use a WindowsFormsHost element to host a System.Windows.Forms ?
|
|
|
| 50.1 How do I
assign full trust to an XBAP application ?
|
| 50.2 I am able
to access the registry using full trust XBAP application in debug mode, when
hosted in an intranet, the application gets crashed. What do I do?
|
| 50.3 How do I get a
custom defined permission set of an XBAP application ?
|
|
|
| 51.1 How
to get data from database in XBAP application ?
|
| 51.2 Does
permission set of partial trust change in the Local Intranet and Internet?
|
51.3 How
do I detect permission for a file in a partial trust application ?
|
|
|
| 52.1 Can
a WPF application be designed using Microsoft Expression Blend ?
|
| 52.2 How
do I add animations using Microsoft Expression Blend ?
|
| 52.3 How
do I add custom controls to an application using Microsoft Expression Blend ?
|
|
|
| 53.1 What is ZAM3D ?
|
| 53.2 What are the file
formats supported by ZAM3D ?
|
| 53.3 Can an XAML file
created using ZAM3D be used with Visual Studio.NET ?
|
|
|
| 54.1 What is XAMLPAD ?
|
| 54.2 Does XAMLPAD support
custom controls ?
|
| 54.3 Can we see the output
of an XAML using XAMLPAD ?
|
|
|
| 55.1 Can I delay the
display of a ToolTip ?
|
| 55.2 How can I use the
ToolTipService properties to specify the position of a tooltip whose content is
not a ToolTip object ?
|
| 55.3 Can I use the
BetweenShowDelay Property ?
|
|
|
| 56.1 How can I make a
TextBlock editable when it is clicked and the value is committed when ESC or
ENTER is pressed?
|
|
|
| 57.1 How do I
prevent the user from changing the selected tab page in a TabControl ?
|
| 57.2 How do I
dynamically hide and unhide tabs in a TabControl ?
|
| 57.3 How do I make
the tabs in a TabControl appear on the bottom instead of the right?
|
| 57.4 How can I add a
style to a TabItem that is used in the TabControl ?
|
|
|
| 58.1 How can I
create a ProgressBar and use an animation to simulate the progress of an
operation ?
|
| 58.2 How can I make
the text changed by itself during progress?
|
|
|
| 59.1 How can I
create and display a PrintDialog ?
|
| 59.2 How do I
display the PrintPreview as a maximized window and control it's zooming ?
|
|
|
| 60.1 How can I animate a
Popup ?
|
| 60.2 How can I specify a
Custom Popup Position ?
|
|
|
| 61.1 How do I format
numbers, dates and currencies in a TextBox ?
|
| 61.2 How do I make a
TextBox use all upper-case (or lower-case) characters ?
|
| 61.3 How do I support
browsing for a text file and reading it into a TextBox?
|
|
|
| 62.1 How can I use the
attached properties of Canvas to position child elements ?
|
|
|
| 63.1 How do I fill a
ComboBox with the available fonts ?
|
| 63.2 How do I bind the
values of an enum to a ComboBox ?
|
|
|
| 64.1 How do I bind a
string array with a ListBox?
|
| 64.2 How do I display
items in a ListBox horizontally?
|
|
|
| 65.1 How do I create
custom layout for StatusBar items?
|
|
|
| 66.1 How do I determine
which button in a ToolBar is clicked ?
|
| 66.2 How can I apply a
Style to a Menu control on a ToolBar ?
|
| 66.3 When I tab into a
toolbar in WPF I can't tab out again ? What can I do to change this tab
behavior ?
|
|
|
| 67.1 How do I make
the Context Menu appear only when clicked at certain portions of the Control ?
|
| 67.2 How can I
enable a Context Menu on a disabled Control ?
|
| 67.3 How can I
create a shared Context Menu ?
|
| 67.4 How do I make
the Context Menu to close after a set time interval?
|
|
|
| 68.1 How can I create
an Expander with a ScrollViewer ?
|
| 68.2 How can I bind
the Expander's header element's Width to the ActualWidth of the Expander ?
|
| 68.3 How do I make the
Expander button to be justified to the right, rather than the left which is the
default ?
|
|
|
| 69.1 How can I
replace the style of a DocumentViewer ?
|
| 69.2 How can I
extend the style of a DocumentViewer ?
|
| 69.3 How can I
DataBind DocumentViewer's Zoom Property to a TextBox ?
|
| 69.4 How to load
an XPS document into the DocumentViewer?
|
|
|
| 70.1 How can
I load an XAML file into a FlowDocumentReader?
|
| 70.2 How can
I save the contents of a FlowDocumentReader as an XAML file ?
|
|
|
| 71.1 How can I create
a GroupBox that has a title and a visible border that encloses it's content ?
|
|
|
| 72.1 How can I
make sure that a GridSplitter Is visible ?
|
| 72.2 How can I
create and use a GridLengthConverter Object ?
|
|
|
| 73.1 How can I convert an
Image to grayscale ?
|
| 73.2 How can I crop an
Image ?
|
| 73.3 Why does adding
images to an ImageList in the Designer cause them to lose their alpha channel ?
|
| 73.4 How to rotate an
image ?
|
| 73.5 How do I access /
edit the metadata associated with an Image ?
|
| 73.6 How can the
DrawVisual be used for rendering images ?
|
|
|
| 74.1 How do I enable the
mnemonics (underlines) being displayed when an application is launched ?
|
| 74.2 How can I style a
Separator used as a Menu Item ?
|
|
|
| 75.1 How can I use
the member values of the enumeration to set the HorizontalScrollBarVisibility
property of the ScrollViewer control ?
|
75.2 How can I use
the Content-Scrolling Methods of ScrollViewer ?
|
|
|
| 76.1 How can I customize
the Ticks on a Slider ?
|
| 76.2 Can I bind two
sliders in two different windows ?
|
|
|
| 77.1 How do I add a
hyperlink to a RichTextBox control ?
|
| 77.2 How do I
create and save a RichTextFormat (RTF) file?
|
| 77.3 How do I
support drag-and-drop for a RichTextBox?
|
| 77.4 How can I
Save, Load, and Print RichTextBox Content ?
|
|
|
| 78.1 How can I animate
the thickness of a border by using ThicknessAnimation ?
|
| 78.2 How can I use a
BulletDecorator control that uses an image as the Bullet and a non-text element
as the Child ?
|
|
|
| 79.1 How do I change the
shape of the button to an ellipse?
|