Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

WPF Inheritance

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 06-29-2006   #1 (permalink)
Russell Mason
Guest


 

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
Guest


 

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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
ACL - Search directories where inheritance has been broken? akcorr PowerShell 2 04-17-2008 08:46 PM
Re: Problem with folder layout inheritance Keith Miller \(MVP\) Vista file management 3 03-15-2008 02:28 AM
Abount inheritance and control... Miguel Ortiz Falcón Avalon 1 05-08-2006 08:47 AM
How can I alter the dependency property inheritance chain? Pascal Bourque Avalon 4 05-01-2006 10:08 AM


Vistax64.com 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 2005-2008

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 47 48 49 50 51