diff -r e377456302df -r a82d9beaa94a ui/winui/table.cpp --- a/ui/winui/table.cpp Tue Oct 17 21:50:48 2023 +0200 +++ b/ui/winui/table.cpp Thu Oct 19 18:30:19 2023 +0200 @@ -41,6 +41,8 @@ #include #include #include +#include +#include using namespace winrt; using namespace Microsoft::UI::Xaml; @@ -76,6 +78,13 @@ uitable->onselectiondata = args.onselectiondata; uitable->onactivate = args.onactivate; uitable->onactivatedata = args.onactivatedata; + uitable->ondragstart = args.ondragstart; + uitable->ondragstartdata = args.ondragstartdata; + uitable->ondragcomplete = args.ondragcomplete; + uitable->ondrop = args.ondrop; + uitable->ondropdata = args.ondropsdata; + uitable->enabledrag = args.enabledrag; + uitable->enabledrop = args.enabledrop; // grid styling winrt::Windows::UI::Color bg = { 255, 255, 255, 255 }; // test color @@ -259,6 +268,17 @@ cellBorder.BorderThickness(b2); } + // dnd + if (enabledrag) { + cellBorder.CanDrag(enabledrag); + cellBorder.DragStarting([](IInspectable const& sender, DragStartingEventArgs args) { + //args.Data().SetText(L"test"); + }); + } + if (enabledrop) { + cellBorder.AllowDrop(enabledrop); + } + // set the cell value // depending on the type, we create different cell controls UiModelType type = model->types[col]; @@ -269,6 +289,7 @@ cell.VerticalAlignment(VerticalAlignment::Stretch); textblock_set_str(cell, (char*)getvalue(elm, model_col)); cellBorder.Child(cell); + break; } case UI_INTEGER: {