.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

[Pseudo]-Visual Form Inheritance in WPF...

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :WPF


I'm coming across from WinForms and need to understand how best to implement this requirement: [Pseudo]-Visual Form Inheritance in WPF. 

In my WinForms app (which I am sloooowly reengineering in WPF), I have lots of 'base' forms that set up certain requirements and generic functionality (such as ListFormBase, which has a data grid and several buttons. This base sets up lots of standard behaviours (CRUD, search, print, print preview, etc). The constructor accepts a generic parameter, which I use to pass in one of my business objects. 

In descendant forms, I simply add functionality that is specific/quirky to the individual business object (such as Product havingthe ability to search back orders, customer having the ability to pull up list of previous orders, etc.) All the standard behaviour comes down to the descendants automatically and new buttons/features are easy to add. This set up works an absolute treat - it's very simple, very effective.

I need to start to understand how to achieve the same in WPF. How do you create Pages in XAML that descend from base versions? How do I also link up the code behind in an OO manner, so that all the behaviour from the base comes down in the descendants? 

Any help would be much appreciated.


Simon Gol

View Complete Post

More Related Resource Links

Master Pages: Master Your Site Design with Visual Inheritance and Page Templates


Master pages in ASP.NET 2.0 solve a problem many Web developers have been solving on their own with a variety of techniques for years - providing a single master template for an entire site. This article covers the details of master pages, discussing their usage and implementation and how they are a natural evolution of custom techniques developers are using today.

Fritz Onion

MSDN Magazine June 2004

Infopath form using Visual Studio - How to bind repeating table on submit button click ?


Hello friends,

   I have created infopath form using Visual Studio 2008

Form have 3 dropdowns and one repeating table which is bound by Datasource ( List from sharepoint ).

whenever i select appropritae values from drop down, Repeating table gets bound as datasource for dropdown and repeating table are same.

I have done conditional formating for repeating table using repeating table properties.


My Question:


Now i included one submit button and i want when i click submit button it will check DropDown Values and if appropriate record matching these values found it will fill repeating table

How i achive this ? as i dont find how to bind repeating table on submit button.

Please help if anyone have answer.


Thanks and Regards,


Kapil Bhosale.




where did i put this in web form using visual studio 2008?

(1)Connection String Sql connection conn=new SqlConnetion ("Data Soure=_______; InitialCatalog=_______;integrated Security = "TRUE"); (2)Binding a control SqlCommand=new SqlCommand ("SELECT STATEMENT", Connection String); SqlDataAdapter da=new SqlDataAdapter(comm); DataSet ds=new DataSet(); da.fill(ds); checkedListBox1.DataSource=ds.Tables[0]; checkedListBox1.DisplayMember="_____"; checkedListBox1.ValueMember="_____";

make a form parent to all other forms in visual studio c#

i have created 2 forms child.cs and parent.cs. I have added the menustrip in parent form. I want that menu strip to be displayed in the child form also. How can i do that? Or else I want to make the parent.cs as the common form to my child.cs. Please help me with the coding that i can understand

Windows form application, Visual basic 9

please give me vb 9 ( visual studio 2008 ) language example, to create shortcut on the desktop, from file notepad.exe which stored in c:\windows\notepad.exe

create task edit form issues for sharepoint 2010 workflow using visual studio 2010

I use infopath 2007 created a task edit form and I use VS 2010 to create a sequential workflow.I want to use the custom tash edit form in the workflow.The problem I got is the InfoPath form doesn't get deployed to sharepoint. I'm able to upload the infopath form to sharepoint though central admin app. here is the element.xml :<Elements xmlns="http://schemas.microsoft.com/sharepoint/">  <Workflow     Name="WorkflowProject4 - Workflow1"     Description="My SharePoint Workflow"     Id="e6aa6cdb-667f-456a-b216-7639a1dcd3c7"     CodeBesideClass="WorkflowProject4.Workflow1.Workflow1"     CodeBesideAssembly="$assemblyname$">    <Categories/>    <MetaData>      <AssociationCategories>List</AssociationCategories>            <Task0_FormURN>urn:schemas-microsoft-com:office:infopath:TaskForm:-myXSD-2009-12-10T22-33-23</Task0_FormURN>      <StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>    </MetaData>  </Workflow></Elements>and here is the feature1.template.xml<Feature xmlns="http://schemas.microsoft.com/sharepoint/">  <Properties>    <Property Key="GloballyAvailable" Value="true" />    <Property Key="RegisterForms" Value="*.xsn"/>  </Properties></Feature>anything

Form inheritance and key press event



I've created a basic form BasicForm which all other forms in my application will inherit. In this basic form I'd like to handle some generic stuff which are common for all of the forms.  An example => key press event, for when user would press ESC key in any of my forms it would automatically close that form. This is how I tried to do it: 


public ref class BasicForm : public System::Windows::Forms::Form

 	protected: virtual void OnKeyPress(KeyPressEventArgs^ e) override
 		if (e->KeyChar == 0x1b ) // ESC

How add custom form field in workflow task using visual studio 2010



I need to create a simple workflow using Visual Studio 2010.

Workflow having following activities:

1. Create a task assign to workflow initiator. This task have one dropdown field with two choice (Approved,Rejected). 

2. Wait for the task change.

3. In Task edit form, only title and custom drop-down field are visible. User need to select from one of the choice and complete the task.

Using AxSpreadsheet in Windows Form with Visual Studio 2008

Hi. at our company we had a very big Visual Studio 2003 solution which was recently migrated to Visual Studio 2008 and .NET Framework 2.0. Everything works fine, except this one form where we use an AxSpreadsheet control so that the user can manipulate an Excel Spreadsheet directly from the form, and we can programatically access the cells he modifies. We are using Microsoft.Office.Interop.Owc11.AxSpreadsheet, which we already signed in VS2003, and worked perfectly. Now, when I try to open the form in desing time, I get an error that says: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Of course, I get the same error at runtime.

Any help? Thanks a lot.
:. HUGONNE .: Please mark as answer if the post helps

problem with Form in visual studio load with delay


my project have a base form

all form in project loading bad. mean tha control on it splash.

where is problem?

C# Is My World

constructors and visual controls in usercontrol inheritance


I'm using usercontrols to populate dynamically created tabpages in my application.

There are a varierty of different types of content which need to share certain features.

For this purpose I've created a usercontrol that I've called "MasterFrame" which will be subclassed to provide the different varieties of tab content.

The MasterFrame contains all the logic for controlling the frame's relationship with it's tab. The masterframe has a constructor that accepts parameters for the tabpage it must fill and a datatable to provide content.


When I create a subclass, the form designer (VS2010) throws an error and will not load UNLESS I create an alternative constructor for the MasterFrame that has no parameters.

Is this the only way round? Is there a better solution? Would you say this is a bug in VS2010?


I have been struggling with visual controls on my "masterframe": I've been unable to 'unlock' a toolstrip to allow adding buttons in a subclass. Is it possible? (I've tried changing modifiers to 'protected' or 'public' but to no avail).

Windows form hanging when ran outside of Visual Studio 2010



I have a windows form that starts a background worker to grab data from a database and put it into a datagridview through a bound datatable. So a decent summary would be:

1. Main Thread: Get a load of order numbers

2. Main Thread: Start a background worker

3. Worker Thread: Go through the order numbers, getting order details and putting them in a datatable

    3.1 Worker Thread: Call my progresschanged method after each time we put order details into the datatable and force the form to update


And this is all fine. It works as expected. Everything is responsive, all the orders load into the view, etc etc. Program done. However, as soon as I run this outside of Visual Studio (so running the .exe in the debug or release folder) it hangs every time the last time it's going to call progesschanged.

So say there are 50 orders, after getting the details for order 50 and calling progresschanged the main thread locks up instantly. There are no errors reported, there is still free memory in the machine, and it works 100% of the time when running through VS.

I have no idea where to look to fix this.



How can i create a Custom Association Form for a workflow in visual studio?


I want to create a Custom Association Form for a workflow in visual studio, how can i do it?

I want to create a Custom Association Form with two buttons Acept and cancel.

Thank you.

Debugging in Visual Studio 2008 Second level form


I'm using Visual Studio 2008 in developing VB.NET windows application , this application contains MDI_PARENT form and many MDI_CHILDS forms.

when i run F5 (start debugging) , and stop in BREAK-POINTS and need to edit the code , it allows me to edit in MDI-PARENT form code , but when i try to edit the MDI-CHILD code it gave me the following message :

changes are not allowed when the debugger has been attached to an already running process.....

I went to:

Tools -> Options -> Debugging -> Edit and Continue

then i disable "Enable Edit and Continue" remove the Checkbox before it . then when i tried to edit it gave me the following error

cannot currently modify this text in the editor. it is read-only

so, how could I enable Edit and Continue in MDI-CHILDS forms ???


Visual Case Tool - UML Tutorial

The Class Diagram

The class diagram is core to object-oriented design. It describes the types of objects in the system and the static relationships between them.

ASP.NET 4 and Visual Studio 2010 Web Development Beta 2 Overview

Many exciting changes for ASP.NET are coming in the .NET Framework version 4. This document gives an overview of many of the new features that are included in the Beta 2 release of the .NET Framework 4 and of Visual Studio 2010.

Visual Studio 2010 Beta 2

This is a big deal. This isn't ".NET 3.6" - there are a lot of improvements of .NET 4, and it's not just "pile on a bunch of features so you get overwhelmed." I've been working with and talking to many of the teams involved and even though it's a cheesy thing to say, this is a really customer-focused release.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend