![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |