Reputation: 153
I have this code.
<MediaElement x:Name="VideoControl" Width="Auto" Height ="{Binding altezza}"
Source="intro.avi" LoadedBehavior="Manual" UnloadedBehavior="Stop">
</MediaElement>
In the .cs
file I have this method
public int altezza{
get { return 150; }
}
But it's not called from WPF element.
How I can fix it?
Thanks you for your reply
Upvotes: 0
Views: 51
Reputation: 8111
You must set the Datacontext to your Codebehind file:
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Upvotes: 2