Вы находитесь на странице: 1из 5

6. What is ContentPresenter?

often used inside control templates it is a placeholder for any XAML content and it can be used to insert content at runtime. A content presenter can be a holder for any controls and can be bound to the content from various elements via TemplateBinding, if used in a template.
7. What is the Difference between TextBlock and Label in WPF.

It derives directly from FrameworkElement. Label, on the other hand, derives from ContentControl. The reason Label text turns gray when it is disabled is due to the fact that Labels default control template has a Trigger which explicitly sets the Foreground property when IsEnabled is false Label supports access keys
8. What is Virtualization in WPF?

UI virtualization is where only your viewable data is processed. In WPF, controls such as your listbox implement virtualization, but some controls such as your combobox do not. In this tutorial, you'll learn how to add virtualization support to a combobox.
9. What is VirtualizingPanel?

Virtualizing panels are involved when an applications performance needs to be improved. It provide a base panel for virtualization of children elements inside it. Instead of creating all the UI element which are inside an ItemControls, only the one which need to be displayed are created. Because the process of creating these elements is intensive, the use of a VirtualizingPanel makes an item controls display faster.
10. What is VirtualizingStackPanel?

The feature of Virtualization is implemented in VirtualizingStackPanel. It will work similar to the StackPanel and also virtualized its child items too.
. You can manually enable or disable virtualization on Listbox control by setting VirtualizingStackPanel.IsVirtualizing property. Internally VirtualizingStackPanel creates item container for each visible item. When item is not visible it destroys that item container. So some times with huge data it is very expensive task to create and destroy item container for each visible item. If you set VirtualizingStackPanel.VirtualizationMode = Recycling then each container will get reuse instead of destroy.
11. 12. WPF 13. How to create a custom VirtualizingPanel? Where is the data grid or gridview control in WPF? ToolKit Explain Binding vs. TemplateBinding in WPF.

Binding provides much more flexibility than TemplateBinding, but its more costly. TemplateBinding is limited to one scenario but very efficient in what it does.

Everytime you want to bind to a property of an element from within its template, you should consider using a TemplateBinding
if you want a one-way binding from within a template to a property of its templated parent, use TemplateBinding. For all other scenarios, or for extra flexibility in this last scenario, use Binding.
14. What are the Various ways to bind?

OneTime: changes Slider Property one time only when we write value in Text box OneWay: Only Text box Property will be updated when we move Slider ..but if we write some value in TextBox it will not be reflected in Slider OneWayToSource: by this option we can update the Value of Slider from Text box but can not Update value of textBox from Slider. TwoWay: if we update the value of textbox it will be reflated to Slider and If we update the value of slider it will be reflected in TextBox .

example: Text="{Binding Mode=OneWayToSource, ElementName=Slider1,Path=Value, UpdateSourceTrigger=PropertyChanged} 15. Explain Source vs. RelativeSource vs. ElementName

The Source property is used to specify an object reference on which the binding Path or XPath will be evaluated. The RelativeSource property is used to specify as a source an object that is positioned relatively to the current object. Exaple:RelativeSource FindAncestor The ElementName property is used to reference an object by the name of the object. This is particularly useful in XAML, where you can directly reference other elements defined in XAML.
16. Explain Logical Tree vs. Visual Tree in WPF

Elements of a WPF user interface are hierarchically related


The logical tree describes the relations between elements of the user interface. The logical tree is responsible for: Inherit DependencyProperty values Resolving DynamicResources references Looking up element names for bindings Forwaring RoutedEvents

The visual tree contains all logical elements including all visual elements of the template of each element

The visual tree is responsible for:


Rendering visual elements Propagate element opacity Propagate Layout- and RenderTransforms

Propagate the IsEnabled property. Do Hit-Testing RelativeSource (FindAncestor)

17. Explain DependencyProperty vs. CLR property 18. What is a DependencyObject?

Most of the WPF classes derive from Dependency Object. All UI Elements are derived from Dependency Object. The Dependency Object class gives all the functionality of the WPF dependency property system. Dependency Object defines WPF Property System. System.Windows.DependencyObject is used to create Dependency Property. Dependency properties are the special property in WPF that are used to support many features in WPF.

19. What is an Adorner?

An Adorner is a custom FrameworkElement that is bound to a UIElement. Adorners are rendered in AdornerLayer .
An adorner is a figure or set of figures overlaid on a graph entity. The adorner temporarily adds features to the graph, typically in the form of controls. In the case of editing features, the overlays are triggered by some action, for example, when the associated element receives focus. The DiagramEditor uses the following main adorners: ResizeAdorner: resizes entities. ConnectionAdorner: creates connections between entities. LinkConnectionAdorner: reconnects existing links. LinkIntermediatePointsAdorner: adds, removes, and edits the intermediate points in links.

20. What is a Decorator?

The System.Windows.Controls.Decorator is provide the functionality to all the decorators. All the decorators are derive from this. Generally all decorators are used for designing and working with controls. In WPF we use many decorators like ButtonChorme decorator is used with button to change its shape and background, one more decorators is ListBoxChorme decorator, it is used with ListBox.
21. What is a WPF Style? To apply the style to a control we set the Style property to our style. To get it from the resources we use the{StaticResource [resourceKey]} markup extension. <Window> <Window.Resources>

<Style x:Key="myStyle" TargetType="Button"> <Setter Property="Background" Value="Orange" /> <Setter Property="FontStyle" Value="Italic" /> <Setter Property="Padding" Value="8,4" /> <Setter Property="Margin" Value="4" /> </Style> </Window.Resources> <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> <Button Style="{StaticResource myStyle}">Styles</Button> <Button Style="{StaticResource myStyle}">are</Button> <Button Style="{StaticResource myStyle}">cool</Button> </StackPanel> </Window> 22. Explain Style vs. Template? 23. How do I create a DataTemplate? 24. What is a Resource Dictionary Declaration? 25. What is Inline Declaration? 26. What is a read-only attached property?

An attached property is a concept defined by Extensible Application Markup Language (XAML). An attached property is intended to be used as a type of global property that is settable on any object. In Windows Presentation Foundation (WPF), attached properties are typically defined as a specialized form of dependency property that does not have the conventional property "wrapper".
27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. How to declare a read-only attached property? How to declare a dependency property? How can you send input programatically? How will you simulate basic keyboard events in WPF? What are the Alternative ways to simulate input? How to simulate basic mouse events? Is there a 'Browse for folder' dialog in WPF? What is ItemsControl? What is the difference between Binding Source and Binding Target What is the difference between Binding vs. BindingExpression How can Expression Blend use DataBinding to a business object? How to customize the way data is displayed Explain ControlTemplate vs. ItemsPresenter vs. IsItemsHost Explain Margin vs. Padding in WPF layout Explain Right-to-left vs. custom controls in WPF How does layout work? What is the difference between StaticResource vs. DynamicResource What is RoutedCommand? What is an attached property? What is a read-only dependency property? How to declare an attached property?

48. How to declare a read-only dependency property? 49. How to create Custom Commands? 50. What is a RoutedEvent? 51. What are the Available Routing Strategies? 52. How to add an Event Handler using XAML? 53. How to add an Event Handler using Code? 54. How to add CLR accessors to a RoutedEvent? 55. Source vs. OriginalSource 56. How to raise a RoutedEvent? 57. How to create Custom Routed Events? 58. What is a DataTemplate? 59. What is a ControlTemplate? 60. Explain what a Gesture is? 61. What are the types of Gesture? 62. How to Add Gestures? 63. What is the difference? Inline Declaration vs. Resource Dictionary Declaration 64. How to create a ControlTemplate 65. How do I create a style or template? 66. Explain Trigger. 67. How do I use my custom control/class in XAML? 68. What is XAML? 69. How to create an object with non-default constructor?

Вам также может понравиться