Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug Scope definition changes when altering XAML
1 replies. Latest Post by Keith.Mahoney on August 5, 2008.
(0)
ThatRickGuy
Member
18 points
75 Posts
08-05-2008 2:48 PM |
Hi guys,
Ran into a bit of an oddity. I have a canvas on a xaml control that I have manually changed its scope to 'Public'. I can load the file in the VS2008 xaml viewer just fine, and the application runs with out a problem. But any time I modify the XAML in either the XAML/Design interface in VS2008, or in Blend, the Page.g.vb file reverts the scope of my canvas from 'Public' back to 'Friend'.
I need that canvas to be public so that I can access it from a class library that holds all of my communication and error handling frame work.
-Rick
Keith.Ma...
Participant
872 points
131 Posts
08-05-2008 4:19 PM |
Hi ThatRickGuy,The g.cs/g.vb files are automatically generated and as such should not be modified manually as any changes made to these files will be lost next time the file is re-generated.If you want to expose one of the child elements of your UserControl, you can create a public property or field, and set it to the correct value in the UserControls constructor. e.g. public class UserControl1 : UserControl{ public UserControl1() { InitializeComponent(); myCanvas = _canvas1; } public Canvas MyCanvas;}or, using a read only property:public class UserControl1 : UserControl{ public UserControl1() { InitializeComponent(); } public Canvas MyCanvas { get { return canvas1; } }}