How to access and set RowProperty a GridSplitter using string Name

vitaminP 1 Reputation point
2022-04-13T00:36:29.027+00:00

I want to re-index dynamically added GridSplitter with string Name

Firstly, I use Grid.SetRow(), but It returns null

I found another way named SetValue and want to use this,
but it's hard to access GridSplitter with string Name

This is what i tried

GridSplitter leftSplitter = FindName(splitterL) as GridSplitter;
SetValue(leftSplitter, i);

//another way
string splitterL = "splitterL" + i.ToString();
SetValue((GridSplitter)splitterL, i);

//returns null
GridSplitter leftSplitter = FindName(splitterL) as GridSplitter;
Grid.SetRow(leftSplitter, i); 

But with SetValue, can't change GridSplitter to DependencyProperty

Is there a way to solve this? Or other way, Please let me know thanks!

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,648 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
756 questions
{count} votes