Why Gradient colors applied to all objects in place of selected object?

I am using Master (latest) version (dated: 17 Jan 2024). It may be v8.3. We have implemented LVGL control in WPF technology.

I want to implement background color for selected object (Rectangle) using gradient / single background color.

When I want to set single color as background of selected object, then I am calling below code:

_declspec(dllexport) void Set_BackColor(lv_obj_t* ptrObj, UINT32 colValue)
{
    if (ptrObj != NULL)
    {
        static lv_grad_dsc_t grad_dsc1;
        grad_dsc1.stops_count = 0;
        lv_obj_set_style_bg_grad(ptrObj, &grad_dsc1, 0);
        lv_obj_set_style_bg_color(ptrObj, lv_color_hex(colValue), LV_PART_MAIN);
    }
}

When I want to set gradient as background color of selected object, then I am calling below code:

__declspec(dllexport) void Set_BackColor_Gradient(lv_obj_t* ptrObj, struct GradientStopInfo1* gradientStopInfo, int gradientDirection, int gradientStopCount) 
{
    if (ptrObj != NULL)
    {
        static lv_grad_dsc_t grad_dsc2;
        grad_dsc2.dir = gradientDirection;
        grad_dsc2.stops_count = gradientStopCount;

        for (int i = 0; i < gradientStopCount; i++)
        {
            grad_dsc2.stops[i].color = lv_color_hex(((UINT32)gradientStopInfo[i].color));
            grad_dsc2.stops[i].frac = gradientStopInfo[i].fraction;
            grad_dsc2.stops[i].opa = gradientStopInfo[i].opacity;
        }
        lv_obj_set_style_bg_grad(ptrObj, &grad_dsc2, 0);
    }
}

If I will apply single color as background of selected object (Rectangle), then it works perfectly.
But if I will apply gradient colors as background of selected object (Rectangle), then same gradient gets applied to all rectangle objects on the screen. It should reflect to selected object. But it reflects to all rectangle objects on the screen.

Anyone know that why is it happening?