![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Inheriting from custom made page in xaml How can I inherit from my custom made page? Example: I have a page baseclass in my 1st assembly: <Page x:Class="Common.WinFX.Pages.DetailPage" xmlns="http://schemas.microsoft.com/winfx/avalon/2005" xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005" Title="DetailPage" > <Grid> <Label>Test</Label> </Grid> </Page> How can I inherit a new page (in another assembly)? If I do this: <DetailPage x:Class="Contact.WinFX.ContactPersonDetail" xmlns="http://schemas.microsoft.com/winfx/avalon/2005" xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005" Title="ContactPersonDetail" > <Grid> </Grid> </DetailPage> I get an error stating that the DetailPage is an unknown tag. I'm "using" the 1st assembly. Do I need to make some xml tag? -- Thomas S. Andersen |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Inheriting from custom made page in xaml <Thomas Andersen> wrote in message news:%23dYZR5REGHA.3068@TK2MSFTNGP10.phx.gbl... > <SNIP> Okay, I cracked the namespace part, but then I got: "Error 25 Common.WinFX.Pages.DetailPage cannot be the root of a XAML file because it was defined using XAML." Can this be try? That seems like a wierd limitation? -- Thomas Andersen |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Inheriting from custom made page in xaml Yes that is a by design limitation for v1. If we do enable this in the future, how would you like the content of the first page to work in the subclassed page? We'd like to understand your scenario. Today, you can make the base class in a programming language and then build the subclasses with markup. Thanks, Rob Relyea WPF Program Manager http://longhornblogs.com/rrelyea <Thomas Andersen> wrote in message news:e4FQrVTEGHA.336@TK2MSFTNGP14.phx.gbl... > <Thomas Andersen> wrote in message > news:%23bI8$QTEGHA.2036@TK2MSFTNGP14.phx.gbl... >> Can this be try? That seems like a wierd limitation? > > Ups, should say: > Can this be right? That seems like a wierd limitation? > > -- > Thomas Andersen > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Inheriting from custom made page in xaml Hi Roy, Thanks for your reply. We are developing a full blown "normal" Windows application in WinFX, so we are going to have a lot of pages for viewing for example details for customers, equipment, locations and so forth. I'm still fondling around in blind. But my idea was to design a base class for detail pages, with the look, feel and commands we would prefer, and then derive and specialize the individual pages. I am not sure how it would handle the content; I was hoping to see how you managed that But I was expecting that I could see the base class in thedesigner and then build on that like a normal Windows form. But it's okay. I got it working with a "coded" base class, so I can certainly live with that. -- Best regards Thomas Andersen Wendia A/S "Rob Relyea [MSFT]" <Rob.Relyea@microsoft.nospam.com> wrote in message news:uTCUflVEGHA.1288@TK2MSFTNGP09.phx.gbl... > Yes that is a by design limitation for v1. > > If we do enable this in the future, how would you like the content of the > first page to work in the subclassed page? > We'd like to understand your scenario. > > Today, you can make the base class in a programming language and then > build the subclasses with markup. > > Thanks, > Rob Relyea > WPF Program Manager > http://longhornblogs.com/rrelyea > > <Thomas Andersen> wrote in message > news:e4FQrVTEGHA.336@TK2MSFTNGP14.phx.gbl... >> <Thomas Andersen> wrote in message >> news:%23bI8$QTEGHA.2036@TK2MSFTNGP14.phx.gbl... >>> Can this be try? That seems like a wierd limitation? >> >> Ups, should say: >> Can this be right? That seems like a wierd limitation? >> >> -- >> Thomas Andersen >> > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Inheriting from custom made page in xaml Rob, My attempts so far to define a page or in my case a window with a base class other than the WPF class have failed. It complains that the generated .g.cs partial class has a different base class than my code behind partial class. Can you point me at a sample that does this? Michael "Rob Relyea [MSFT]" <Rob.Relyea@microsoft.nospam.com> wrote in message news:uTCUflVEGHA.1288@TK2MSFTNGP09.phx.gbl... > Yes that is a by design limitation for v1. > > If we do enable this in the future, how would you like the content of the > first page to work in the subclassed page? > We'd like to understand your scenario. > > Today, you can make the base class in a programming language and then > build the subclasses with markup. > > Thanks, > Rob Relyea > WPF Program Manager > http://longhornblogs.com/rrelyea > > <Thomas Andersen> wrote in message > news:e4FQrVTEGHA.336@TK2MSFTNGP14.phx.gbl... >> <Thomas Andersen> wrote in message >> news:%23bI8$QTEGHA.2036@TK2MSFTNGP14.phx.gbl... >>> Can this be try? That seems like a wierd limitation? >> >> Ups, should say: >> Can this be right? That seems like a wierd limitation? >> >> -- >> Thomas Andersen >> > > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Inheriting from custom made page in xaml Hi Michael, Here is how I did mine: _________ 1st file DetailPageBase.cs: --- using System; using System.Collections.Generic; using System.Text; namespace Common.WinFX.Pages { public class DetailPageBase: System.Windows.Controls.Page { } } _________ 2nd file ContactPersonDetail.xaml: --- <?Mapping XmlNamespace="Local" ClrNamespace="Common.WinFX.Pages" Assembly="Common.WinFX" ?> <Local etailPageBase x:Class="Contact.WinFX.ContactPersonDetail"xmlns="http://schemas.microsoft.com/winfx/avalon/2005" xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005" Title="ContactPersonDetail" xmlns:Local="Local"> <Grid> </Grid> </Local etailPageBase>_________ 3rd file ContactPersonDetail.xaml.cs: --- using System; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Common.WinFX.Pages; namespace Contact.WinFX { /// <summary> /// Interaction logic for ContactPersonDetail.xaml /// </summary> public partial class ContactPersonDetail : DetailPageBase { public ContactPersonDetail() { InitializeComponent(); } } } Hope you can figure out the example. -- Best regards, Thomas Andersen "Michael Latta" <lattam@mac.com> wrote in message news:OkDb9fjEGHA.532@TK2MSFTNGP15.phx.gbl... > Rob, > > My attempts so far to define a page or in my case a window with a base > class other than the WPF class have failed. It complains that the > generated .g.cs partial class has a different base class than my code > behind partial class. Can you point me at a sample that does this? > > Michael > > > "Rob Relyea [MSFT]" <Rob.Relyea@microsoft.nospam.com> wrote in message > news:uTCUflVEGHA.1288@TK2MSFTNGP09.phx.gbl... >> Yes that is a by design limitation for v1. >> >> If we do enable this in the future, how would you like the content of the >> first page to work in the subclassed page? >> We'd like to understand your scenario. >> >> Today, you can make the base class in a programming language and then >> build the subclasses with markup. >> >> Thanks, >> Rob Relyea >> WPF Program Manager >> http://longhornblogs.com/rrelyea >> >> <Thomas Andersen> wrote in message >> news:e4FQrVTEGHA.336@TK2MSFTNGP14.phx.gbl... >>> <Thomas Andersen> wrote in message >>> news:%23bI8$QTEGHA.2036@TK2MSFTNGP14.phx.gbl... >>>> Can this be try? That seems like a wierd limitation? >>> >>> Ups, should say: >>> Can this be right? That seems like a wierd limitation? >>> >>> -- >>> Thomas Andersen >>> >> >> > > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Inheriting from custom made page in xaml Thanks, I will give that a try when I get a chance. Your example was very clear. Michael <Thomas Andersen> wrote in message news:eLHCLvpEGHA.3820@TK2MSFTNGP12.phx.gbl... > Hi Michael, > > Here is how I did mine: > _________ > 1st file DetailPageBase.cs: > --- > using System; > using System.Collections.Generic; > using System.Text; > > namespace Common.WinFX.Pages > { > public class DetailPageBase: System.Windows.Controls.Page > { > } > } > _________ > 2nd file ContactPersonDetail.xaml: > --- > <?Mapping XmlNamespace="Local" ClrNamespace="Common.WinFX.Pages" > Assembly="Common.WinFX" ?> > <Local etailPageBase x:Class="Contact.WinFX.ContactPersonDetail"> xmlns="http://schemas.microsoft.com/winfx/avalon/2005" > xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005" > Title="ContactPersonDetail" > xmlns:Local="Local"> > <Grid> > </Grid> > </Local etailPageBase>> _________ > 3rd file ContactPersonDetail.xaml.cs: > --- > using System; > using System.Windows; > using System.Windows.Controls; > using System.Windows.Data; > using System.Windows.Documents; > using System.Windows.Media; > using System.Windows.Media.Imaging; > using System.Windows.Navigation; > using System.Windows.Shapes; > using Common.WinFX.Pages; > > namespace Contact.WinFX > { > /// <summary> > /// Interaction logic for ContactPersonDetail.xaml > /// </summary> > > public partial class ContactPersonDetail : DetailPageBase > { > public ContactPersonDetail() > { > InitializeComponent(); > } > } > } > > Hope you can figure out the example. > > -- > Best regards, > Thomas Andersen > > > "Michael Latta" <lattam@mac.com> wrote in message > news:OkDb9fjEGHA.532@TK2MSFTNGP15.phx.gbl... >> Rob, >> >> My attempts so far to define a page or in my case a window with a base >> class other than the WPF class have failed. It complains that the >> generated .g.cs partial class has a different base class than my code >> behind partial class. Can you point me at a sample that does this? >> >> Michael >> >> >> "Rob Relyea [MSFT]" <Rob.Relyea@microsoft.nospam.com> wrote in message >> news:uTCUflVEGHA.1288@TK2MSFTNGP09.phx.gbl... >>> Yes that is a by design limitation for v1. >>> >>> If we do enable this in the future, how would you like the content of >>> the first page to work in the subclassed page? >>> We'd like to understand your scenario. >>> >>> Today, you can make the base class in a programming language and then >>> build the subclasses with markup. >>> >>> Thanks, >>> Rob Relyea >>> WPF Program Manager >>> http://longhornblogs.com/rrelyea >>> >>> <Thomas Andersen> wrote in message >>> news:e4FQrVTEGHA.336@TK2MSFTNGP14.phx.gbl... >>>> <Thomas Andersen> wrote in message >>>> news:%23bI8$QTEGHA.2036@TK2MSFTNGP14.phx.gbl... >>>>> Can this be try? That seems like a wierd limitation? >>>> >>>> Ups, should say: >>>> Can this be right? That seems like a wierd limitation? >>>> >>>> -- >>>> Thomas Andersen >>>> >>> >>> >> >> > > |
My System Specs![]() |