![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Updated (aciddently hit post before) Exposing properties of subcon So, I'm playing around with XAML and EID, and although I'm not sure whether I completely understand the concepts yet, I have a question. So I'm creating a control template. This specific control template is for a button, and I put a menu in it, and on the menu I made another control template for the menu item, which noiw has a text box and a button on it. Pretty useles, but I'm trying to get a feel for the limitations of the system. Now, on the form, I also have another templated control, a ListBox where I added a MediaElement in the background, so that it plays a movie behind the list box items. Again, fairly useless, but it looks cool. So, in my useless appplication, what I'd like to do it whenever someone clicks the button on the menu item, read the value from the text box and update the value of the MediaElement's source, programattically. The problem is that the path of access to the subcontrols of the control template isn't clear at all from the top level of the applicatiion. I have no idea how to get the value. Is it possible to expose the properties of a subcontrol on a control template to the top level? So I could read the value of the text box like a value of the button. Or, what is the best way to do this, barring data binding. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Updated (aciddently hit post before) Exposing properties of subcon Hey Matt, > The problem is that the path of access to the subcontrols of the control > template isn't clear at all from the top level of the applicatiion. I have > no idea how to get the value. Is it possible to expose the properties of a > subcontrol on a control template to the top level? So I could read the value > of the text box like a value of the button. Attached Properties allow you to inherit values of properties: http://blogs.msdn.com/nickkramer/sea...q=attached&p=1 In decmber CTP (and I think in january CTP, too) it was not possible to reference elements within a template control's visual tree directly. There is a way to retrive elements within such a template through myButton.Template.FindName("myNestedMenu", myButton) from code. Try to set the binding from code then. > Or, what is the best way to do this, barring data binding. Probably you know that you can react on ChangeNotifications manually and care about sync by yourself. This would be one way I think. Chris |
My System Specs![]() |