Name as many layout controls as you can:
A: Grid, DockPanel, Canvas, WrapPanel, UniformGrid, StackPanel.
StackPanel has an Orientation Property for horizontal or vertial alignment
What controls have you worked in WPF
TabGrid, DataGrid, Drop downs, List Boxes, etc.
Describe how you would go about writing your own button style?
ou need to display a list of items. Which controls are possible options? Of those, which would you use and why?
ItemsControl, ListBox, ListView, DataGrid.
What are common Localization/Globalization practices for Localizing/Globalizing WPF?
A: 1) Use Resources.resx, 2) Use BAML, 3) Use a ResourceDictionary to manage localizable strings.
What is the Binding syntax for binding to a Static value?
Provide a situation in which you have or would use a ConverterParameter.
Tri State Values
When should you use “code-behind” in MVVM.
A: When the code only involves the View or WPF Controls in the View.
A: When you need to implement events that do not support binding to ICommand.
What is the difference between xmlns and xmlns:x in WPF ?
The first namespace is the default namespace and helps to resolve overall WPF elements.
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
The second namespace is prefixed by “x:” and helps to resolve XAML language definition.
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:name : is used to define an object instance
What are the different ways of defining ViewModels in a WPF View ?
1) Import namespace where the class resides
<Window x:Class="LearnWpfResources.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custns="clr-namespace:LearnWpfResources"
Title="MainWindow" Height="350" Width="525">
2) Create an object
<Window.Resources>
<custns:Customer x:Key="custobj"/>
</Window.Resources>
3) Bind a property of the object to a control.
<TextBox Text="{Binding CustomerCode, Mode=TwoWay, Source={StaticResource custobj}}" />
What are contentpresenter ?
Difference between UI / Framework Element ?
Explain WPF relative binding / relative resource?
When we define bindings we need at least two elements target and source. But many times rather than defining binding between two elements we would like to define binding with reference to the current element i.e. RELATIVELY.
For instance let’s say we have a WPF border and we would like height and width of the broder to be same. So for this scenario the target and source are the same, the WPF border itself.
<Border BorderBrush="Black" BorderThickness="1" Height="139"Width="{Binding Height, RelativeSource={RelativeSource Self}}"/>
Property
Description
AncestorType
Which type of parent element is it?. Is it a border element , grid element etc.
AncestorLevel
An element can have multiple parents. For example in the above XAML we have two parents one with red color and the other with green. So this property specifies which level of parent element we want to refer. Below is the figure which depicts the levels. The red color border is level 1 and the green color border is level 2.
Binding
This specifies which property we want to bind to. For the current example we want to bind to border’s brush color.
<Border BorderBrush="DarkGreen">
<Border BorderBrush="DarkRed”>
<TextBox />
</Border>
</Border>
<TextBox Background="{Binding BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Border}}}"/>
Style Triggers
============
Want a style property to execute under certain conditions
<Style x:Key="myStyle" TargetType="Button">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
<Setter Property="Background" Value="Aqua" />
</Style>
Routed Events
----------------
A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event
Markup Exstensions
The following are the built-in markup extensions:
1)Binding:-To bind the values of two properties together.
2)StaticResource:-One time lookup of a resources entry
3)DynamicResource:-Auto updating lookup of a resource entry
4)TemplateBinding:-To bind a property of a control template to a dependency property of the control
5)x:Static:-Resolve the value of a static property.
6)x:Null:-Return null
Difference between control and Data Templates ?
A DataTemplate, therefore, is used to provide visual structure for underlying data, while a ControlTemplate has nothing to do with underlying data and simply provides visual layout for the control itself.
What is content presenter ?
CONTENT PRESENTER: Content Presenter in WPF is used inside control templates, as well as inside the root application markup. The concept of ContentPresenter is quite simple – it is a placeholder for any XAML content and it can be used to insert content at runtime. Or we can say that ContentPresenter is a class that will automatically take the content of the ContentControl and display it, when placed into a ContentControl's ControlTemplate.
A content presenter is used via the ContentPresenter element:
<ContentPresenter></ContentPresenter>
Syntax:
<ContentPresenter Name="MyContent">
<ContentPresenter.Content>
<Button>Click Me</Button>
</ContentPresenter.Content>
</ContentPresenter>
Use Practical Examples of Routed/Attached Events/Dependency Property/Attached properties in the financial domain
C#
====
When would you use partial and why ?