Hello, Does anyone know why my ListView with following Code is not working? I checked it out with Snoop and the ItemsSource seems to be fine (and when I start Snoop, the ListView displays me the MyViewModel.MyCollection, but when debugging with Visual Studio it shows me nothing?)
Thank you!
PS: MainWindow.xaml.cs has the DataContext = MainViewModel
<ListView Grid.Row="1" Margin="38,50,0,168" HorizontalAlignment="Left" Name="listViewSelectDate" Width="105"
ItemsSource="{Binding Path=MyViewModel.MyCollection}"
SelectedItem="{Binding SelectedDate}" IsSynchronizedWithCurrentItem="True">
<ListView.View>
<GridView>
<GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=CalcDate}"/>
</GridView>
</ListView.View>
</ListView>
The ViewModel looks like this:
class MainViewModel : ViewModelBase
{
public SummaryViewModel MyViewModel
{
get { return _myViewModel; }
set { _myViewModel = value; RaisePropertyChanged("MyViewModel"); }
}
public MyDate SelectedDate
{
get { return _selectedDate; }
set { _selectedDate = value; RaisePropertyChanged("SelectedDate"); }
}
}
and
public class SummaryViewModel : ViewModelBase
{
public ObservableCollection<MyDate> MyCollection { get; set; }
}
and
public class MyDate
{
public DateTime CalcDate { get; set; }
}