Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - WPF Inheritance

 
 
Old 06-29-2006   #1 (permalink)
Russell Mason


 
 

WPF Inheritance

Hi

How does inheritance work in WPF?

One of the great things about WinForms is that you create a form and its
layout and can inherit from it. The base class contains the code to create
the controls and lay it out, you just add the new bit you want for the
specific derived form.

WPF and XAML look like they are going the way of ASP, code separated from
the HTML. The problem with ASP is that inheritance is a pig. The controls are
inherited but the layout etc. is not, therefore you have to keep copying the
HTML from the base class HTML to the derived classes HTML, ASP can then
create new versions of the controls which conflict with those already created
in the base class. Controls are also more difficult to write/use in ASP
compared with the WinForm equivalent.

How does XAML and WPF overcome this major problem? Obviously the window is
inherited but how do you 'inherit' the XAML/layout. If anyone knows of any
articles that explain this I would be most grateful.

Thanks
Russell Mason


My System SpecsSystem Spec
Old 07-04-2006   #2 (permalink)
Nimrand


 
 

RE: WPF Inheritance

Well, for one, you don't have to use XAML. You can just as well write your
own class derived from Window or any other type of control, and write the
code that populates the window/control. In many ways, its not very different
than the form designer in previous versions of .NET. The designer is just a
visual representation of the code that is being generated to populate the
form. XAML, on the other hand, is just a declarative/XML representation the
objects in the window/control. You can still derive new classes or add
anything you want to the class, and you can access anything declared in the
XAML by its name as a member of the class. Hope this helps.

"Russell Mason" wrote:

> Hi
>
> How does inheritance work in WPF?
>
> One of the great things about WinForms is that you create a form and its
> layout and can inherit from it. The base class contains the code to create
> the controls and lay it out, you just add the new bit you want for the
> specific derived form.
>
> WPF and XAML look like they are going the way of ASP, code separated from
> the HTML. The problem with ASP is that inheritance is a pig. The controls are
> inherited but the layout etc. is not, therefore you have to keep copying the
> HTML from the base class HTML to the derived classes HTML, ASP can then
> create new versions of the controls which conflict with those already created
> in the base class. Controls are also more difficult to write/use in ASP
> compared with the WinForm equivalent.
>
> How does XAML and WPF overcome this major problem? Obviously the window is
> inherited but how do you 'inherit' the XAML/layout. If anyone knows of any
> articles that explain this I would be most grateful.
>
> Thanks
> Russell Mason
>

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
ADsSecurity and Inheritance VB Script
ACL - Search directories where inheritance has been broken? PowerShell
Re: Problem with folder layout inheritance Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46