C
C#14mo ago
Florian Voß

❔ GridSplitter like in WPF but in Maui

in WPF there is a GridSplitter control. When using drag & drop on that control you can use it to resize Grid columns and rows around it. In Maui there is no GridSplitter control but I need one. The best thing I could find from googling "GridSplitter Maui" is this page https://learn.microsoft.com/en-us/dotnet/communitytoolkit/windows/sizers/gridsplitter. But there is only a communitytoolkit for UWP and WinUI applications, so that would only work in my windows build, but not in my android or ios build from my understanding. Can anyone help me to get a GridSplitter in my maui app that will work on all the platforms and not just one?
2 Replies
Florian Voß
Florian VoßOP14mo ago
I guess I'm going to try implementing this myself, shouldn't be too hard. Here is some pseudo code, please let me know if you have any corrections / improvements: class GridSplitter{ properties: Colour, Orientation public void OnDrag(object sender, EventArgs e){ //when sender is not a GridSplitter || parent is not a Grid -> return early //get coordinates from EventArgs //when orientation is horizontal, calculate difference between initial and final y coordinate, when orientation is vertical, do this for x coordinate instead //when orientation is horizontal, for positive coordinate difference, increase height of the row below gridsplitter and decrease height of the row above gridsplitter, for negative coordinate difference decrease height of the row below gridsplitter and increase height of the row above //when orientation is vertical, do the steps from previous point but with columns' widths instead of rows' heights } } I have tried to implement this now: https://pastecord.com/oruvivemaw Does anyone have an idea how to go about translating a GridUnitType.Star value to a GridUnitType.Absolute value? cuz the e.TotalX and e.TotalY I get from the PanelUpdated handler are in pixels. The rows and columns I am resizing have their Height.GridUnitType as GridUnitType.Star. How to translate this to a GridUnitType.Absolute value so that I can properly add or subtract the TotalX or TotalY value and create a new absolute GridLength?
Accord
Accord14mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server