![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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) |
| | 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 | |
| |
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 | |||