-
My WPF window's view model resembles the following: public class ViewModel : INotifyPropertyInfo
{
private ObservableCollection<MyItems> _myItems;
public ObservableCollection<MyItems> MyItemCollection
{
get => _myItems;
set =>
{
_myItems = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MyItemCollection)));
}
}
} My WPF window's code-behind class resembles this: public partial class MainWindow : Window
{
public static readonly DependencyProperty VMProperty = DependencyProperty.Register("VM"
, typeof(ViewModel)
, typeof(MainWindow)
);
public ViewModel VM
{
get => (ViewModel)GetValue(VMProperty);
set => SetValue(VMProperty, value);
}
} Now, wenn I bind an What am I doing wrong? Here's an excerpt of my <Window x:Class="GaqlReplApplication.WpfWindows.Main.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" x:Name="MainWin"
DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
>
<ListView ItemsSource="{Binding Path=VM.MyItemCollection}"/>
</Window> |
Beta Was this translation helpful? Give feedback.
Answered by
miloush
Sep 1, 2025
Replies: 1 comment 14 replies
-
Do you have a small repro project? |
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And you silently update the underlying storage, so you don't have a way of notifying it anyway. If Settings is INotifyPropertyChanged, then it might work if you bind to
Settings.Preferences.FileMruList
instead.