Oops : )

I wasn't using a callback my dep property to update the CLR property :)

Public Shared ReadOnly ItemTemplateProperty As DependencyProperty = 
DependencyProperty.Register("ItemTemplate", GetType(UserControl), 
GetType(SomeContainer), New PropertyMetadata(New 
PropertyChangedCallback(AddressOf SetItemTemplateCallback)))

Public Shared Sub SetItemTemplateCallback(ByVal obj As DependencyObject, ByVal 
propertyValue As DependencyPropertyChangedEventArgs)
        CType(obj, SomeContainer).ItemTemplate = CType(propertyValue.NewValue, 
UserControl)
    End Sub

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jordan Knight
Sent: Friday, 19 September 2008 8:37 AM
To: [email protected]
Subject: [OzSilverlight] Data Binding Question

Hi all,

I have a UserControl which I want to bind a property to from it's own XAML 
markup...

The control has a property on it called ChildControl and I want to bind a value 
to it from my ViewModel. I don't want to bind to this property from the control 
that created it (i.e. <my:Control ChildControl="{Binding blah}"/>

I want to do this:

<UserControl x:Class="MyProject.SomeContainer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
             xmlns:my="clr-namespace:MyProject"
             Width="{Binding ConfiguredWidth}"    <-- Works
             Height="{Binding ConfiguredHeight}" <-- Works
             my: SomeContainer.ItemTemplate="{Binding ChildControl, 
Mode=OneTime}" <-- Doesn't work
    >

The property ChildControl that I'm binding to here gets called and the control 
is returned but the binding is not completed (I don't think the Dep property is 
communicating with the CLR property)...

e.g.

My Dep Prop (Public Shared ReadOnly ItemTemplateProperty As DependencyProperty) 
references my CLR prop (Public Property ItemTemplate() As UserControl) but the 
setter is never called on the CLR prop.

Any assistance would be helpful.

Thanks,

Jordan.
------------------------------------------------------------------- 
OzSilverlight.com - to unsubscribe from this list, send a message back to the 
list with 'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net



------------------------------------------------------------------- 
OzSilverlight.com - to unsubscribe from this list, send a message back to the 
list with 'unsubscribe' as the subject.

Powered by mailenable.com - List managed by www.readify.net

Reply via email to