Q1. What is WPF?
WPF stands for Windows Presentation Foundation. It is an application programming Interface for developing rich UI on Windows. WPF is introduced in .NET 3.0. By the use of WPF we can create two and three dimensional graphics,animations etc.
Q2. What is XAML and how it is related to WPF?
XAML is a new mark up language which is used for defining UI elements and its relationships with other UI elements. The XAML is introduced by WPF in .NET 3.0 WPF uses XAML for UI design.
Q3. Does XAML file compiled or Parsed?
By default XAML files are compiled ,But we do have options to let it be parsed.
Q4. What is the root namespace used for Animations and 3D rendering in WPF?
System.Windows.Media namespace.
Q5. What are the names of main asseblies used by WPF?
a)WindowsBase
b)PresentationCore
c)PresentationFoundation
b)PresentationCore
c)PresentationFoundation
Q6. What operating systems support WPF?
Following are the operating systems that support WPF
a)Windows7
b)Windows Vista
c)Windows XP Service Pack 2 or later
a)Windows7
b)Windows Vista
c)Windows XP Service Pack 2 or later
Q7. Describe the types of documents supported by WPF?
There are two kinds of document supported by WPF
a)Flow format:Flow format document adjusts as per screen size and resolution
b)Fixed Format:Fixed Format document does not adjust as per screen size and resolution
a)Flow format:Flow format document adjusts as per screen size and resolution
b)Fixed Format:Fixed Format document does not adjust as per screen size and resolution
Q8. What namespaces are needed to host a WPF control in Windows form application?
The following namespaces needs to be referenced :
a)PresentationCore.dll
b)PresentationFramework.dll
c)UIAutomationProvider.dll
d)UIAutomationTypes.dll
e)WindowsBase.dll
a)PresentationCore.dll
b)PresentationFramework.dll
c)UIAutomationProvider.dll
d)UIAutomationTypes.dll
e)WindowsBase.dll
Q9. What is Dependency Property In WPF?
Windows Presentation Foundation (WPF) has a set of services that is used to extend the functionality of a common language runtime property. These services are referred as the WPF property system. A property that is backed by the WPF property system is known as a dependency property
Q10.What is routed event in WPF?
A WPF user interface is constructed in a layered approach, where one visual element can have zero or more child elements. so we can visualise the elements tree for the full page. Routed events are a new feature provided by WPF which allows events to travel down the elements tree to the target element, or bubble up the elements tree to the root element. When an event is raised, it "travels" up or down the elements tree invoking handlers for that event on any element subscribed to that event it encounters en route.This tree traversal does not cover the entire elements tree, only the ancestral element chain between the root element and the element which is the target of the event.
Q: When should I use WPF instead of DirectX? (Is DirectX dead?) |
DirectX is definitely not dead and is still more appropriate than WPF for advanced developers writing hard-core “twitch games” or applications with complex 3D models where you need maximum performance. That said, it’s easy to write a naive DirectX application that performs far worse than a similar WPF application. DirectX is a low-level interface to the graphics hardware that exposes all of the quirks of whatever GPU a particular computer has. DirectX can be thought of as assembly language in the world of graphics: You can do anything the GPU supports. WPF provides a high-level abstraction that takes a description of your scene and figures out the best way to render it, given the hardware resources available. Internally, this might involve using Shader Model 3.0, or the fixed-function pipeline, or software. (Don’t worry if you’re not familiar with these terms, but take it as a sign that you should be using WPF!). The downside of choosing DirectX over WPF is a potentially astronomical increase in development cost. A large part of this cost is the requirement to test your application on each driver/GPU combination you intend to support. One of the major benefits of building on top of WPF is that Microsoft has already done this testing for you! You can instead focus your testing on low-end hardware for measuring performance. The fact that WPF applications can even leverage the client GPU over Remote Desktop or in a partial-trust environment is also a compelling differentiator. |
Q: When should I use WPF instead of Windows Forms?(Is Windows Forms dead?) |
WPF is clearly more suitable for applications with rich media, but some people have said that Windows Forms is the best choice for business applications with traditional user interfaces. I think this belief is based on first versions of WPF in which many standard controls didn’t exist (such as TreeView, ListView, and OpenFileDialog) and a visual designer didn’t exist, making traditional Windows application development in WPF harder than in Windows Forms. Although Windows Forms still has useful controls that WPF lacks (such as DataGridView and PropertyGrid) and at the time of writing has a larger set of third-party controls in the marketplace, WPF has compelling features even for traditional user interfaces (such as the support for resolution independence or advanced layout). |
Q: When should I use WPF instead of Adobe Flash? |
For creating rich web content, Flash is currently the most popular option because of its ubiquity. You can put Flash-based content on a website with confidence that the overwhelming majority of visitors already have the necessary player installed. (And if they don’t, it’s a very quick download.) WPF applications can also run within a web browser. WPF has the advantage of better development tools and programming model, a richer feature set, robust control reuse, broad programming language support, and full access to the underlying platform (when security permits). But viewing such content requires Windows and the .NET Framework 3.0 (installed by default on Windows Vista or later). |
Q: How do I get a ToolTip to appear when hovering over a disabled element? |
use the ShowOnDisabled attached property of the ToolTipService class! From XAML, this would look like the following on a Button: <Button ToolTipService.ShowOnDisabled=”True”> </Button> Or from C# code, you can call the static method corresponding to the attached property: ToolTipService.SetShowOnDisabled(myButton, true); |
Q: How can I forcibly close a ToolTip that is currently showing? |
Set its IsOpen property to false. |
Q: What’s the difference between ComboBox’s IsEditable and IsReadOnly properties? | ||||||||||||||||||||
Setting IsEditable to true turns ComboBox’s selection box into a text box. IsReadOnly controls whether that text box can be edited, just like TextBox’s IsReadOnly property. This means that IsReadOnly is meaningless unless IsEditable is true, and IsEditable being true doesn’t necessarily mean that the selection text can be edited. Below in the table sums up the behavior of ComboBox based on the values of these two properties. The Behavior for All Combinations of IsEditable and IsReadOnly
| ||||||||||||||||||||
Q: When the SelectionChanged event gets raised, how do I get the new selection? |
The SelectionChanged event is designed to handle controls that allow multiple selections, so it can be a little confusing for a single-selection selector such as ComboBox. The SelectionChangedEventArgs type passed to event handlers has two properties of type IList: AddedItems and RemovedItems. AddedItems contains the new selection and RemovedItems contains the previous selection. e.g. void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) object newSelection = e.AddedItems[0]; } Like this code, never assume that there’s a selected item! Besides the fact that ComboBox’s selection can be cleared programmatically, it can get cleared by the user when IsEditable is true and IsReadOnly is false. In this case, if the user changes the selection box text to something that doesn’t match any item, the SelectionChanged event is raised with an empty AddedItems collection. |
No comments:
Post a Comment