I use the Parts and States model with a generic.xaml template if you want/need a default style.
Control.cs inheriting from Control or ContentControl then in the constructor if you want to wire up a generic template you do the DefaultStyleKey = typeof (MyClass); Then override onapplytemplate() and wire up the parts. Is this what you're after? From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Wednesday, 24 March 2010 2:47 PM To: [email protected] Subject: RE: Create a child for a UserControl? Hi Scott, I did try this once, and while I still think it's possible I failed. In the end I created a new UserControl using the template, and copied my code across. It was relatively simple. Carl. From: [email protected] [mailto:[email protected]] On Behalf Of Scott Barnes <[email protected]> Sent: Wednesday, 24 March 2010 12:40 PM To: ozSilverlight <[email protected]> Subject: Create a child for a UserControl? Q. Does anyone know if you can instantiate a Control into a raw UserControl class, in that if you File->New->MyClass and then inherit UserControl. How does one new-up a Grid/Panel etc within the construct of that class? (Given it has no MyClass.Children) I know you can do it if do MyClass.xaml.cs via that approach, but interested to know of an alternative approach? Scott. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________ ozsilverlight mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight ____________________________________________________________________________ ___ Unencrypted electronic mail is not secure and may not be authentic. If you have any doubts as to the contents please telephone to confirm. This electronic transmission including any attachments is intended only for those to whom it is addressed. It may contain copyright material or information that is confidential, privileged or exempt from disclosure by law. Any claim to privilege is not waived or lost by reason of mistaken transmission of this information. If you are not the intended recipient you must not distribute or copy this transmission and should please notify the sender. Your costs for doing this will be reimbursed by the sender. We do not accept liability in connection with computer virus, data corruption, delay, interruption, unauthorised access or unauthorised amendment. ____________________________________________________________________________ ___ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
_______________________________________________ ozsilverlight mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
