This is a migrated thread and some comments may be shown as answers.

Data Binding inside a DataTemplate not working

1 Answer 100 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eddie
Top achievements
Rank 1
Eddie asked on 20 Jul 2013, 12:49 AM
Hello,

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" >  
  <gauges:MarkerGaugeIndicator.MarkerTemplate>
    <DataTemplate>
      <Grid Width="50">
 
         <TextBlock x:Name="MFP" FontSize="16" Text="{Binding MFPercent}"  />
 
       </Grid>
     </DataTemplate>
   </gauges:MarkerGaugeIndicator.MarkerTemplate>
 </gauges:MarkerGaugeIndicator>

 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.

1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 22 Jul 2013, 03:04 PM
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.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Gauge
Asked by
Eddie
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Share this question
or