Skip to main content

Microsoft Silverlight

Answered Question Silverlight 2 beta Binding to object doesn't workRSS Feed

(1)

ABL
ABL

Member

Member

0 points

3 Posts

Silverlight 2 beta Binding to object doesn't work

I created an Usercontrol as below with a TextBlock binding to the Usercontrol's custom dependency property MessageText

<UserControl x:Class="SO.MessageBox" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="400" Height="300" x:Name="myMessage">

 

<StackPanel Background="Black">

<Button Name="closeBtn" Width="100" Height="40" Content="Close"></Button>

<TextBlock Foreground="Azure" x:Name="messageLblBlock"  Text="{Binding ElementName=myMessage, Path=MessageText} FontSize="28" Width="300" Height="100"></TextBlock>

</StackPanel>

</UserControl>

In the refering page the tag is

<so:MessageBox MessageText="MyMessage" Grid.Row="1" Grid.ColumnSpan="2"

HorizontalAlignment="Left" x:Name="message" > </so:MessageBox>

This simply doesn't work. The dependencyproperty MessageText is in the code class for MessageBox. Any Clues?

ABL

chad.campbell
chad.cam...

Participant

Participant

1918 points

332 Posts

Silverlight MVP
Answered Question

Re: Silverlight 2 beta Binding to object doesn't work

Silverlight 2 does not support UI-to-UI binding.  You can only bind a CLR object to a UI element in Silverlight 2. 

If this answers your question, please select "mark as answer", otherwise, please post a follow up question. Thanks!
Chad Campbell

Author of Silverlight 2.0 in Action Blog: http://cornucopia30.blogspot.com

rocktheroad
rocktheroad

Member

Member

54 points

27 Posts

Re: Silverlight 2 beta Binding to object doesn't work

Is this just for this Beta release, or this is not planned in version 2? Is there any roadmap for SL2 published, they announced it on MIX...

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities