Код: Выделить всё
private void OnAddHomeworkClicked(object sender, EventArgs e)
{
var button = (Button)sender;
int column = ScheduleGrid.GetColumn(button);
int row = ScheduleGrid.GetRow(button);
if (column >= 4) return;
Entry homeworkEntry = new Entry();
ScheduleGrid.Children.Add(homeworkEntry);
ScheduleGrid.SetRow(homeworkEntry, row);
ScheduleGrid.SetColumn(homeworkEntry, column);
var deleteButton = CreateDeleteButtonForHomework(homeworkEntry);
ScheduleGrid.Children.Add(deleteButton);
ScheduleGrid.SetRow(deleteButton, row);
ScheduleGrid.SetColumn(deleteButton, column);
ScheduleGrid.Children.Remove(button);
ScheduleGrid.Children.Add(button);
ScheduleGrid.SetRow(button, row);
ScheduleGrid.SetColumn(button, column + 1);
}
Код: Выделить всё
private global::Microsoft.Maui.Controls.Grid ScheduleGrid;
Код: Выделить всё
При выполнении строки ScheduleGrid.Children.Add(button); выдается исключение System.Runtime.InteropServices.COMException с сообщением об ошибке: Установленные компоненты не найдены. Код ошибки: 800F1000, что на самом деле означает то же самое. Какие компоненты не установлены — загадка.
Стек вызовов:
Код: Выделить всё
at WinRT.DelegateExtensions.DynamicInvokeAbi(Delegate del, Object[] invoke_params)
at ABI.System.Collections.Generic.IListMethods`2.InsertAtDynamic(IObjectReference obj, UInt32 index, T value)
at ABI.System.Collections.Generic.IVectorMethods`1.InsertAt(IObjectReference obj, UInt32 index, T value)
at ABI.System.Collections.Generic.IListMethods`1.InsertAtHelper(IObjectReference obj, UInt32 index, T item)
at ABI.System.Collections.Generic.IListMethods`1.Insert(IObjectReference obj, Int32 index, T item)
at Microsoft.UI.Xaml.Controls.UIElementCollection.Insert(Int32 index, UIElement item)
at Microsoft.Maui.Handlers.LayoutHandler.Add(IView child)
at Microsoft.Maui.Handlers.LayoutHandler.MapAdd(ILayoutHandler handler, ILayout layout, Object arg)
at Microsoft.Maui.CommandMapper`2.c__DisplayClass6_0.b__0(IElementHandler h, IElement v, Object o)
at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
at Microsoft.Maui.CommandMapper.Invoke(IElementHandler viewHandler, IElement virtualView, String property, Object args)
at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
at Microsoft.Maui.Controls.Layout.OnAdd(Int32 index, IView view)
at Microsoft.Maui.Controls.Grid.OnAdd(Int32 index, IView view)
at Microsoft.Maui.Controls.Layout.Add(IView child)
Подробнее здесь: https://stackoverflow.com/questions/792 ... ents-found