Binding to ElementName in WP7

6 posts, 0 answers
  1. Kamil
    Kamil avatar
    6 posts
    Member since:
    Sep 2011

    Posted 25 Feb 2012 Link to this post

    I have a problem with dynamic xaml loading in WP7 application.

    Dashboard content = XamlReader.Load(PathToXamlFile) as Dashboard;

    Xaml file code:

    <g:Dashboard xmlns:g="http://schemas.xxx.com/mobile"
     
    <g:Dashboard.ObserverDefinitions>       
        <g:DoubleObserver x:Name="DoubleName" EntityName="entName" UpdateRate="1000" Value="12.3"/>
    </g:Dashboard.ObserverDefinitions>
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
     
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=DoubleName,   Path=Value}"/>
    </Grid>
     
    </g:Dashboard>

    Double observer implements INotifyPropertyChanged. While using WPF for desktop application, after dynamic loading, PropertyChangedEvent is set properly. However on WP7 it is null.

    Have You got any idea, if there is an workaround for this problem?

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 28 Feb 2012 Link to this post

    Hi Kamil,

    I tested a simple scenario with an object that implements INotifyPropertyChanged and the binding to a property of that object works as expected.

    Please send a sample application that demonstrates the issue so that I may assist you.

    Regards,
    Victor
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Kamil
    Kamil avatar
    6 posts
    Member since:
    Sep 2011

    Posted 28 Feb 2012 Link to this post

    Hi!
    I've made a Sample app, but where can I send it? 

    Kamil
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 29 Feb 2012 Link to this post

    Hi Kamil,

    You need to open a support ticket and attach the app. You can't attach files in a forum post.
    Please open a support ticket so that I may assist you.

    Kind regards,
    Victor
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Kamil
    Kamil avatar
    6 posts
    Member since:
    Sep 2011

    Posted 29 Feb 2012 Link to this post

    Hi!
    I've just make a ticket: I hope, that You will find what is wrong with my code - "Your ticket ID is: 517625"


    Small update:
    After set binding in codebehind:
    Grid g = content.Content as Grid;
    TextBox t = g.Children[0] as TextBox;
    Binding binding = new Binding();
    binding.Source = content.ObserverDefinitions[0];
    binding.Path = new PropertyPath("Value");
    t.SetBinding(TextBox.TextProperty, binding);

    everything is done properly. So dynamic binding is not working in wp7 (this is my final thought, but I still wait for You answer about my SampleApp)

    Have a nice day!
    Kamil
  7. Eugeniy
    Eugeniy avatar
    60 posts
    Member since:
    Feb 2011

    Posted 25 Jul 2012 Link to this post

    Is double name  null?
Back to Top
DevCraft banner