Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble Binding class to grid, second place
    primarykey
    data
    text
    <p>So I'm trying to create my own music player. I have a Listview updating properly with current playlist. My problem begins when I want a grid to show the song which is currently playing. When binding to those strings they all return <code>Null</code>.</p> <p>From Class:</p> <pre><code>public class Song : INotifyPropertyChanged { public string Title { get; set; } public string Path { get; set; } public string Artist { get; set; } public int Time { get; set; } public string Album { get; set; } //public ImageBrush Portrait { get; set; } public event PropertyChangedEventHandler PropertyChanged; public Song(string title, string path, string artist, int time, string album)//, ImageBrush portrait) { this.Path = path; this.Title = title; this.Artist = artist; this.Time = time; this.Album = album; //this.Portrait = portrait; } public string SongCurrentPlaying { get { return Title; } set { Title = value; OnPropertyChanged("SongCurrentPlaying"); } } protected void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(Title)); } } </code></pre> <p>From XAML:</p> <pre><code> &lt;Grid HorizontalAlignment="Left" Height="143" VerticalAlignment="Top" Width="276"&gt; &lt;Image HorizontalAlignment="Left" Height="124" Margin="10,10,0,0" VerticalAlignment="Top" Width="134" Stretch="Fill"/&gt; &lt;TextBlock HorizontalAlignment="Left" Margin="144,100,0,0" TextWrapping="Wrap" Text="{Binding Songs.Title}" VerticalAlignment="Top" Height="25" Width="122"/&gt; &lt;TextBlock HorizontalAlignment="Left" Margin="144,40,0,0" TextWrapping="Wrap" Text="{Binding SongCurrentPlaying.Title, PresentationTraceSources.TraceLevel=High}" VerticalAlignment="Top" Height="25" Width="122"/&gt; &lt;TextBlock HorizontalAlignment="Left" Margin="144,70,0,0" TextWrapping="Wrap" Text="{Binding Song.Title}" VerticalAlignment="Top" Height="25" Width="122"/&gt; &lt;TextBlock HorizontalAlignment="Left" Margin="144,10,0,0" TextWrapping="Wrap" Text="{Binding Songs.Title}" VerticalAlignment="Top" Height="25" Width="122"/&gt; &lt;/Grid&gt; </code></pre> <p>As you can see I've been experimenting on different bindings to get values from Title as example, none has been successful. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload