I know, maybe it is a simple question, bu I don’t know how to realiza this:
I have my xaml code:
<phone:PhoneApplicationPage.Background>
<ImageBrush ImageSource="/conTgo;component/resources/images/bg_settings.png" Stretch="None"/>
</phone:PhoneApplicationPage.Background>
<TextBlock TextWrapping="Wrap" Text="{Binding VersionNumber}" Foreground="{StaticResource PhoneAccentBrush}" FontFamily="Segoe WP Black" FontSize="26.667" TextAlignment="Center" LineHeight="16"/>
</phone:PhoneApplicationPage>
In my code behind I have:
public string VersionNumber { get; set; }
How can I realise this?
The MVVM pattern is highly recommended for Silverlight development and works well for cases like this as well as setting your code up better for unit testing.
However, If your property that your binding to resides directly in your control and you want to keep it there then your control will need to implement INotifyPropertyChanged in order for the property to hook into Silverlight’s (or WPF’s) change notification:
Again, I would definitely recommend a MVVM approach however.