Fair enuf

Shane Morris  |  Automatic Studio  |  
[email protected]<mailto:[email protected]>  |  +61 438 
818 888

On 28/10/2011, at 6:49 PM, "Matt Hamilton" 
<[email protected]<mailto:[email protected]>> wrote:

Yeah I think that’ll work too. Since the name is (for all intents and purposes) 
private to the XAML of the UserControl itself, I usually do it this way just so 
the bindings are a bit more readable. I don’t know if there’s a perf benefit 
one way or the other.

From: Shane Morris (Automatic Studio)<mailto:[email protected]>
Sent: Friday, October 28, 2011 6:42 PM
To: ozWPF<mailto:[email protected]>
Cc: ozWPF<mailto:[email protected]>
Subject: Re: Child controls as dependency properties

You couldn't use an ancestor/relative source binding to find the parent UC, 
thus Avoiding having to give the UC a specific name?

Shane


Shane Morris  |  Automatic Studio  |  
[email protected]<mailto:[email protected]>  |  +61 438 
818 888

On 28/10/2011, at 5:35 PM, "Greg Keogh" <[email protected]<mailto:[email protected]>> 
wrote:

I generally declare my dependency property as normal, then bind to it from the 
UserControl itself. So let’s say you had a real DP called TitleText, I’d do 
something like:

<UserControl ... x:Name=”me”>
    <TextBlock Text=”{Binding TitleText,ElementName=me}” />

... so now the owner of the UserControl can set TitleText and it will be 
reflected by the child control.


Thanks Matt ... fabulous! I stared at this code for some time before I realised 
what was happening. I didn’t think of doing it this way around. You make a 
typical DP for TitleText then bind the child control to “its own control”. This 
works, but I have to x:Name the <UserControl> and bind use that name as the 
ElementName exactly as you say.

Cheers, Greg
_______________________________________________
ozwpf mailing list
[email protected]<mailto:[email protected]>
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

________________________________
_______________________________________________
ozwpf mailing list
[email protected]<mailto:[email protected]>
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
_______________________________________________
ozwpf mailing list
[email protected]<mailto:[email protected]>
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to