MCTS 70-511 pass guide


In this article I am going to focus on some of the concepts which I remember appeared in the MCTS 70-511, Windows Application Development Exam. I am going to write the important topics which are covered in the exam and give brief introduction to each topic whenever possible.

Following are the topics which are covered:

1. ElementHost
Explanation: ElementHost control is used to host a WPF element into Windows Forms project. One of its important property is a Child property which indicates type of WPF control to be hosted by the ElementHost control.
If the WPF control which is hosted is the part of the solution as that of the Windows Project then Child property can be set in the Property Grid else Child property must be an instance of WPF control in code.
For Example:
Step1: Create a Windows Forms application. Then Drag and Drop and ElementHost control on the form.
Step2: In the same solution, Add a WPF Application. By Default a Usercontrol1.xaml file is already added to the project. In this xaml file add the below code:


<StackPanel>
<TextBlock Text="My WPF UserControl"></TextBlock>
</StackPanel>

Step3:Build the WPF application and the reference of this WPF application dll in the WindowsForms Application
Step4: In the Windows Forms Application, Open Form1.cs file and add the below code in the Form1 constructor as shown. this will add WPF user control as child element of the ElementHost control.

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//add preexisting WPF user controls to your Windows Forms project by using the ElementHost control.
//ElementHost control hosts a WPF element
WinControlsInWPFDemo.UserControl1 uc = new WinControlsInWPFDemo.UserControl1();
elementHost1.Child = uc;
}
}


Step4: Now Make Windows Application as Start up project and run the application. This will display the WPF usercontrol as part of windows form.
2.WindowsElementHost
3.Resource Files , Merged Dictionaries
4.Click Once Deployment
5.PresentationTraceSources
6.TreeView - Get data from xml, Class, Hierarchy Data
7.ListBox - selected item bind to label
8.CommandBinding
9.Animation
10.TableLayoutPanel
11.AssemblyInfo file
12. Assembly Manifest file
13. Settings.Setting file - User and Application settings
To change the value of a user setting, We need to assign it a new value, Then call the Save method as shown below:
Properties.Settings.Default.TestSetting= "This is test";
Properties.Settings.Default.Save();
Here TestSetting is a property in the settings file.

The difference between user setting and application setting is as follows:
A User Setting is user specific whereas Application Setting is constant for all users of the application.
A User Setting can be set at run time whereas Application Settings are read only at run time.
A user setting can vary from user to user whereas application setting is common for all users.

We can store following information in setting file:
user preferences
web server address
color scheme of an application

Settings can be accessed through the Properties.Settings.Default object
Settings are strongly typed

method to save the new value.
14.styles - basedOn, Precedence
15.Dynamic Resource, Static Resource
16.Difference between Layout controls: Uniform Grid, StackPanel(scrolling), Grid, Canvas(Positioniong)
17.AutomationPeer
18.MediaPlayer, MediaElement,Sound Player
19.IDataErrorInfo
20.ObservableCollection
21.INotifyPropertyChanged
22.ICommand interface
23.Adding/Removing elements from Grid
24.Attached Properties
25.Dependency Properties
26.Triggers
27.mage.exe tool
28.SetupProjects - Registry entry, FileEditor, Installer
29. WPF Tree Visualizer
30.Code Access Security
31.UserAccountControl(UAC) permissions
32.Implementing DragandDrop functionality
33. Async Processing - ProgressBar, Dispatcher, ThreadWorkQueueItem
34. Parallel Programming
35.ErrorProvider control
36.DataGridView custom painting
37.Binding to Nullable value
38.Setting UpdateSourceTrigger
39.ControlTemplates, DataTemplates, TemplatedParent
40.ContentPresenter
41.UserControls
42.GroupBox, ComboBox : List Based controls which contains an Items collection to organize items.
ListBox: User can selec t one or more controls
ComboBox: provides user an option to type an entry in the combobox or select one or more controls.
43. Finding resource at run time : FindResource method is used to find resource at runtime and it takes key of the resource as a parameter to find the resource:
Example:

<Window.Resources>
<LinearGradientBrush x:Key="gradBrush" StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="White" Offset="0"></GradientStop>
<GradientStop Color="Black" Offset="1"></GradientStop>
</LinearGradientBrush>
</Window.Resources>
<StackPanel Name="sp1">
<Button Name="btn4">Button 4</Button>
</StackPanel>btn4.Background = (Brush)this.FindResource("gradBrush ");

44.Transforms - Render Transform, Layout Transform
RenderTransform: The Transform is applied after all the other elements have been laid out.
LayoutTransform:The Transform is applied when laying out all the other elements.
Flip using ScaleTransform. Below example Flips a button horizontally:

<Button Height="40" Width="110" VerticalAlignment="Bottom">
<Button.RenderTransform>
<ScaleTransform ScaleX="-1"></ScaleTransform>
</Button.RenderTransform>Flipped Button
</Button>
To flip an element but maintain its original position, We need to set the element's RenderTransformOrigin property to .5,.5, as shown here in bold:
<Button RenderTransformOrigin=".5, .5" Height="70" Width="110"
VerticalAlignment="Bottom">
<Button.RenderTransform>
<ScaleTransform ScaleX="-1"></ScaleTransform>
</Button.RenderTrav nsform>Flipped Button
</Button>

45.packuri syntax :
a. Pack URI syntax is generally used if we want to access resources from other assemblies and locations.
b. For example the following code uses a pack URI syntax to specify the source to be used for a n image.
<StackPanel Name="sp1">
<Image Name="img1"></Image>
<Image Name="img2"></Image>
</StackPanel>
In the below example, Desert.jpg file is present in the root of the application.
Uri uri1 = new Uri("pack://application:,,,/Desert.jpg");
img2.Source = new BitmapImage(uri1);
In the below example, Desert.jpg file is present in the Images folder of the application.
//Uri uri1 = new Uri("pack://application:,,,/Images/Desert.jpg");
In the below example, Desert.jpg file is present in ResourcesDemo assembly.
Uri uri2 = new Uri("pack://application:,,,/ResourcesDemo;component/Desert.jpg");
img2.Source = new BitmapImage(uri2);


Article by Vaishali Jain
Miss. Jain Microsoft Certified Technology Specialist in .Net(Windows and Web Based application development)

Follow Vaishali Jain or read 127 articles authored by Vaishali Jain

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: