DataGrid cell not updating from Binding source

I work with an MVVM WPF application that uses Bindings. It has the following simplified code:

XAML

<TabControl x:Name="tbcGeneral"
            DataContext="{Binding Path=AppCoreInstance, RelativeSource={RelativeSource AncestorType=local:FirstWindow}}">
    <Button x:Name="btnAssignPilot"
            Command="{Binding Path=JobManagingInstance.AssignPilotCommand}">
        <Label x:Name="lblAssignPilot"
               Content="_Assign pilot"/>
    </Button>

    <DataGrid x:Name="dgrMannedSpaceships"
              ItemsSource="{Binding Path=HRManagementInstance.AvailableSpaceships}"
              AutoGenerateColumns="False"
              IsReadOnly="True"
              SelectedItem="{Binding Path=HRManagementInstance.CurrentSpaceship}"
              IsSynchronizedWithCurrentItem="True">
        <DataGrid.Columns>
            <DataGridTextColumn Header="Spaceship number"
                                Binding="{Binding NumSpaceship}"/>
            <DataGridTextColumn Header="Name"
                                Binding="{Binding SpaceshipName}"
                                Width="*"/>
            <DataGridTextColumn Header="Pilot ID"
                                Binding="{Binding PilotId}">
            </DataGridTextColumn>
        </DataGrid.Columns>
    </DataGrid>
</TabControl>

ViewModel

ISpaceShip

    public interface ISpaceShip : ISignalModifBase
    // ISignalModifBase inherits from INotifyPropertyChanged; as noted
    //  below, its implementation has a method that manages the contents 
    //  of a standard set method.
    {
        string NumSpaceship { get; set; }
        string SpaceshipName { get; set; }
        string PilotId { get; set; }
    }

SpaceShip

    public class SpaceShip : SignalModifBase, ISpaceShip
    {
        public string NumSpaceship { get; set; }

        public string SpaceshipName { get; set; }

        private string _strPilotId = "";
        public string PilotId
        {
            get => _strPilotId;
            set => ManagePropertyChange(ref _strPilotId, value); 
            // ManagePropertyChange is a method from SignalModifBase that does the usual Binding-friendly setting
            // stuff of setting the property and invoking PropertyChanged .
        }
    }

IHRManagement

    public interface IHRManagement : IBaseModule
    // IBaseModule inherits from ISignalModifBase, which, in turn, inherits from INotifyPropertyChanged
    {
        ObservableCollection<ISpaceShip> AvailableSpaceships { get; set; }

        ISpaceShip CurrentSpaceship { get; set; }

        bool AssignPilots();
    }

HRManagement

    public class HRManagement : BaseModule, IHRManagement
    {
        private ObservableCollection<ISpaceShip> _obcAvailableSpaceships = new();
        public ObservableCollection<ISpaceShip> AvailableSpaceships
        {
            get => _obcAvailableSpaceships;
            set => ManagePropertyChange(ref _obcAvailableSpaceships, value);
        }

        private ISpaceShip? _objCurrentSpaceship = null;
        public ISpaceShip? CurrentSpaceship
        {
            get => _objCurrentSpaceship;
            set => ManagePropertyChange(ref _objCurrentSpaceship, value);
        }

        bool AssignPilots()
        {
            string z_strData;
            StreamReader z_sreData;

            // Set z_sreData

            foreach (ISpaceShip z_objShip in AvailableSpaceships)
            {
                CurrentSpaceship = z_objShip;
                string z_strPilotId;
                // Figure out which pilot ID goes on this ship and set it in z_strPilotId
                CurrentSpaceship.PilotId = z_strPilotId;
            }
        }
    }

I’m leaving out the infrastructure for relative brevity, as well as a lot of other code that doesn’t have a direct impact on the issue.

There’s another method in IHRManagement and HRManagement that fills AvailableSpaceships and is called by another button.

So before I click on btnAssignPilot, the DataGrid dgrMannedSpaceships is full, except its column “Pilot ID” is empty. When I click on the button, the column “Pilot ID” remains empty; when the job ends (or when I interrupt it in debug, jumping to the end of the method), it fills up entirely.

I’d like to see the column fill one cell after another, and from what I’ve seen here, and on various other Web sites it should. (I’ve tried to add Mode=OneWay to the ItemsSource Binding from this, to no avail.) What did I miss?

I’m using .Net 8.0, if it helps.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

DataGrid cell not updating from Binding source

I work with an MVVM WPF application that uses Bindings. It has the following simplified code:

XAML

<TabControl x:Name="tbcGeneral"
            DataContext="{Binding Path=AppCoreInstance, RelativeSource={RelativeSource AncestorType=local:FirstWindow}}">
    <Button x:Name="btnAssignPilot"
            Command="{Binding Path=JobManagingInstance.AssignPilotCommand}">
        <Label x:Name="lblAssignPilot"
               Content="_Assign pilot"/>
    </Button>

    <DataGrid x:Name="dgrMannedSpaceships"
              ItemsSource="{Binding Path=HRManagementInstance.AvailableSpaceships}"
              AutoGenerateColumns="False"
              IsReadOnly="True"
              SelectedItem="{Binding Path=HRManagementInstance.CurrentSpaceship}"
              IsSynchronizedWithCurrentItem="True">
        <DataGrid.Columns>
            <DataGridTextColumn Header="Spaceship number"
                                Binding="{Binding NumSpaceship}"/>
            <DataGridTextColumn Header="Name"
                                Binding="{Binding SpaceshipName}"
                                Width="*"/>
            <DataGridTextColumn Header="Pilot ID"
                                Binding="{Binding PilotId}">
            </DataGridTextColumn>
        </DataGrid.Columns>
    </DataGrid>
</TabControl>

ViewModel

ISpaceShip

    public interface ISpaceShip : ISignalModifBase
    // ISignalModifBase inherits from INotifyPropertyChanged; as noted
    //  below, its implementation has a method that manages the contents 
    //  of a standard set method.
    {
        string NumSpaceship { get; set; }
        string SpaceshipName { get; set; }
        string PilotId { get; set; }
    }

SpaceShip

    public class SpaceShip : SignalModifBase, ISpaceShip
    {
        public string NumSpaceship { get; set; }

        public string SpaceshipName { get; set; }

        private string _strPilotId = "";
        public string PilotId
        {
            get => _strPilotId;
            set => ManagePropertyChange(ref _strPilotId, value); 
            // ManagePropertyChange is a method from SignalModifBase that does the usual Binding-friendly setting
            // stuff of setting the property and invoking PropertyChanged .
        }
    }

IHRManagement

    public interface IHRManagement : IBaseModule
    // IBaseModule inherits from ISignalModifBase, which, in turn, inherits from INotifyPropertyChanged
    {
        ObservableCollection<ISpaceShip> AvailableSpaceships { get; set; }

        ISpaceShip CurrentSpaceship { get; set; }

        bool AssignPilots();
    }

HRManagement

    public class HRManagement : BaseModule, IHRManagement
    {
        private ObservableCollection<ISpaceShip> _obcAvailableSpaceships = new();
        public ObservableCollection<ISpaceShip> AvailableSpaceships
        {
            get => _obcAvailableSpaceships;
            set => ManagePropertyChange(ref _obcAvailableSpaceships, value);
        }

        private ISpaceShip? _objCurrentSpaceship = null;
        public ISpaceShip? CurrentSpaceship
        {
            get => _objCurrentSpaceship;
            set => ManagePropertyChange(ref _objCurrentSpaceship, value);
        }

        bool AssignPilots()
        {
            string z_strData;
            StreamReader z_sreData;

            // Set z_sreData

            foreach (ISpaceShip z_objShip in AvailableSpaceships)
            {
                CurrentSpaceship = z_objShip;
                string z_strPilotId;
                // Figure out which pilot ID goes on this ship and set it in z_strPilotId
                CurrentSpaceship.PilotId = z_strPilotId;
            }
        }
    }

I’m leaving out the infrastructure for relative brevity, as well as a lot of other code that doesn’t have a direct impact on the issue.

There’s another method in IHRManagement and HRManagement that fills AvailableSpaceships and is called by another button.

So before I click on btnAssignPilot, the DataGrid dgrMannedSpaceships is full, except its column “Pilot ID” is empty. When I click on the button, the column “Pilot ID” remains empty; when the job ends (or when I interrupt it in debug, jumping to the end of the method), it fills up entirely.

I’d like to see the column fill one cell after another, and from what I’ve seen here, and on various other Web sites it should. (I’ve tried to add Mode=OneWay to the ItemsSource Binding from this, to no avail.) What did I miss?

I’m using .Net 8.0, if it helps.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật