150 – WPF Designer Introduction

150 – WPF Designer Introduction


hello welcome to this virtual labs session my name is Joel Reyes developer Evangelist from microsoft public section in this video i will show you that
new visual studio 2008 WPF designer how through new operablity
you can take in your systems windows control and make in part new WPF
solutions so why do we need this well end user expect much more
for their user experience these days we have graphics technologies there are very high quality so
we should be able to use them more effectively also organizations that are interested in achiving
progress in this area wanna do so without having start from scratch so one way to do that is to be able to
leverage the existing investment that they made on windows forms controls and incorporated them into this new WPF solutions so through this video and the lab you learn how with using this features of WPF and interoperablity
you can accomplish this we’re gonna do so by exploring
WPF designer itself and also show you how you can use
windows forms host controls to then account for the windows form control hosting
within WPF forms we are going to accomplish that by
taking an application a WPF application making some UI modifications and then
incorporate into that system windows form control we have an existing application already so lets open that this called coho winery just for convenience we’ve created the
priory already so you’ll see that in this project we have basically the UI designer split into two
sections so lets open that up we have basically the UI and the
XAML in UI you basically have a rendering engine that uh… you can do anything visually
you can zooming and now to uh… you can make a convenience for your display and in the
bottom we have the xaml where i can make changes in properties and that changes are
reflected automatically on the visual section away of the
design section away we have columns and rows so here you
hav0e a uh… RowDefinitions that has saved height and weight by simple click on the left section
there likewise we can create a column by clicking on the column section and you’ll see that a column definitions inserted into the
xaml again with the width and uh… height so that’s very convenient then we can have things like changing
the color on the properties or you can use the Intellisense to make those
changes directly through xaml or if you are hardcore you can type the actual color-coded directly onto the xaml
property and i make that value resignation there either way it’s gonna be reflected on the designer
section so that you can see real time everything
that’s happening when change in xaml so let me actually show you also that you can at add control to this Grid
so we’re going to add an image control that image control is gonna host an image file and uh… you can see that in the UI i can make adjustments directly in the xaml then
corresponding xaml gets changed also so there is a one-to-one
correspondence between the UI designer and xaml editor so let’s make this fit between the cell and once should done that then we’re going to basically bind
that to the file the image file that’s in my
project we do that by specifying a
source property for the image control so we’re gonna say source
equals and give the path within my project were that image files is located the editor to will automatically bind
the final image file to the control and do it in runtime and also do the
same things so its very convenient likewise we’re going to add a listbox to the cell below and that’s going to contain list that itself has images and descriptions also
you’ll see it in a minute so virtualy i can make adjustments to this and
see the corresponding xaml well and uh… so let me show a little more about that you see here i have a cohoresources xaml file that is defining the data provider the date provider points to a
an xml file and specify some Xpath so we can parse it then also let me show what that file looks like so here we have a simple xml right so on that xml i have things
like uh… reference to wine id name
vintage refrence to the picture and description and those are being bind bound to that particular control and
obviously do in runtime do that by specify the item source we has some binding property to with that points
to where the source of binding is so you see that the control is there
let’s see what happens when you run it so i have my my image here and i also have the control that has
been rendered with both images and text with font color etcetera all that has happened automatically if you
will by the control binding capability now the interesting parts starts
now when we actually uh… host a windows forms control inside of
these WPF form so we’re gonna do it by draging the windows forms host control we’re gonna adjusted it virtulay and then basically through code
we will be able to instantiate the calendar control to be hosted within uh… windows forms host uh… control specific for WPF uh… forms so what we do that’s go to code behind specified that for that
particular instance of the forms host we’re going to associat child to new
instance of the uh… month calendar and i want to do that basically when
you run it you’ll see that everything coexist very nicely together so i have my image
here i have my calendar controller can
navigate in perform just fine and i can also have my listbox on the left here that allows me to uh… have images and description altogether
so everything coexists so now that you have seen it in action its time for you to
give it a try so please visit the address on your
screen and i’ll take you directly to the
virtual lab environement where you’ll be able to follow step by
step instruction on how to do this


One thought on “150 – WPF Designer Introduction

Leave a Reply

Your email address will not be published. Required fields are marked *