Data Binding inside a DataTemplate not working

Thread is closed for posting
2 posts, 0 answers
  1. Eddie
    Eddie avatar
    2 posts
    Member since:
    Jul 2013

    Posted 19 Jul 2013 Link to this post


    I can't seem to get this to work.

    <!-- this binding works just fine -->
    <TextBlock Text="{Binding MFPercent}" HorizontalAlignment="Center" VerticalAlignment="Top" />
    <!-- but this binding does not work AT ALL -->
    <gauges:MarkerGaugeIndicator x:Name="MFMarker" Value="66" >  
          <Grid Width="50">
             <TextBlock x:Name="MFP" FontSize="16" Text="{Binding MFPercent}"  />

     The two items are in the same Grid.  I omitted the rest of the Gauges code for brevity's sake. The gauge appears just fine.  I am not sure what is causing the binding issue.  I know that the DataContext of MFMarker is what I want it to be. Shouldn't the DataContext of the TextBlock inside the DataTemplate be the same?  I would greatly appreciate any help anyone can give.  Thank you.

  2. Deyan
    Deyan avatar
    2147 posts

    Posted 22 Jul 2013 Link to this post

    Hi Eddie,

    Thanks for writing.

    Can you please send us the project you are reproducing this with so that we can directly debug the code and see what causes the glitch. Based on the shared XAML snipped we cannot exactly say what the reason might be.

    Thanks for your time.

    P.S. You will have to use the already opened support ticket to attach your project as attachments here are not allowed for security reasons.

    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top