Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Using a custom control as a parent for other controls - Writeable property or collection
1 replies. Latest Post by duefectu on October 8, 2008.
(0)
dafatdude
Member
40 points
16 Posts
10-08-2008 3:49 AM |
Hello All,
I've created a custom dock control in RC0 for a work project. The Heirarchy looks like this:
Dock - Ribbons - RibbonItems - Menus
My XAML looks like this:
1 <Dock:Dock.Ribbons> 2 <Dock:DockRibbon Label="Layers" Icon="images/layers_grey.png" SelectedIcon="images/layers.png"/> 3 <Dock:DockRibbon Label="Tools" Icon="images/tools_grey.png" SelectedIcon="images/tools.png"> 4 <Dock:DockRibbon.RibbonItems> 5 <Dock:RibbonItem Label="Test Item in XAML"> 6 <Dock:RibbonItem.Menu> 7 <Dock:BaseRibbonItemMenu> 8 9 </Dock:BaseRibbonItemMenu> 10 </Dock:RibbonItem.Menu> 11 </Dock:RibbonItem> 12 </Dock:DockRibbon.RibbonItems> 13 </Dock:DockRibbon> 14 <Dock:DockRibbon Label="Searches" Icon="images/search_grey.png" SelectedIcon="images/Search.png"/> 15 <Dock:DockRibbon Label="Printing" Icon="images/print_grey.png" SelectedIcon="images/print.png"/> 16 <Dock:DockRibbon Label="Display Options" Icon="images/display_grey.png" SelectedIcon="images/display.png"/> 17 <Dock:DockRibbon Label="Views" Icon="images/views_grey.png" SelectedIcon="images/views.png"/> 18 </Dock:IndjiDock.Ribbons> 19 </Dock:IndjiDock> 20
The <Dock:BaseRibbonItemMenu></Dock:BaseRibbonItemMenu> is where i'm having the trouble.
The BaseRibbonItemMenu has a canvas in it where it can store any kind of controls and i want to be able to expose this to XAML. I tried to expose the canvas as a public property, but when i try access this with <BaseRibbonItemMenu.Canvas> or just <Canvas> I get an error Writeable property or collection expected.
Is there an attribute i need to use to expose this to the XAML?
I want to use it like a normal canvas class. ie:
1 <Canvas> 2 <Button> 3 <TextBlock> 4 <Canvas> Thanks in advance.
1 <Canvas> 2 <Button> 3 <TextBlock> 4 <Canvas>
Thanks in advance.
duefectu
Participant
786 points
238 Posts
10-08-2008 6:00 AM |
I'm not sure if I understand your question...
If you want to access to a Canvas of an UserControl, you can make something like this:
XML:
...<Canvas x:Name="myCanvas"> ...</Canvas>
.cs:
...Public Canvas publicCanvas;...Public UserControl(){ publicCanvas = myCanvas; ...}...