# Render method doesn't work on Avalonia

**URL:** <https://discourse.vtk.org/t/render-method-doesnt-work-on-avalonia/13588>\
**Category:** Development\
**Tags:** code\
**Created:** [March 20, 2024, 8:28am UTC](https://discourse.vtk.org/t/render-method-doesnt-work-on-avalonia/13588 "2024-03-20T08:28:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yimadong](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/y/9dc877/32.png) [@yimadong](https://discourse.vtk.org/u/yimadong)\
**Post date:** [March 20, 2024, 8:28am UTC](https://discourse.vtk.org/t/render-method-doesnt-work-on-avalonia/13588/1 "2024-03-20T08:28:56Z")

</div>

Hi, I am using VTK on Avalonia, but I can’t get the render method work after the RenderWindowControl is created.  
I created several triangles and added texture to them.  
And I have a button to change the texture.  
But the display won’t change with the render method.  
Only mouse interaction with a interactor can refresh the display.  
The Avalonia sample is too simple.  
How should I force render the VTK control to refresh the display?

```auto
            byte os = 0;

            for (var i = 0; i < _textureData.Length; i++)
            {
                if (i == 0) os = (byte)new Random().Next(0, 255);
                _textureData[i] = os;
            }

            _texture = vtkTexture.New();
            _imageImport = vtkImageImport.New();

            _imageImport.SetDataExtent(0, 255, 0, 255, 0, 0);
            _imageImport.SetWholeExtent(0, 255, 0, 255, 0, 0);
            _imageImport.SetDataScalarTypeToUnsignedChar();
            _imageImport.SetNumberOfScalarComponents(1);

            var pinnedArray = GCHandle.Alloc(_textureData, GCHandleType.Pinned);
            var pointer = pinnedArray.AddrOfPinnedObject();
            
            _imageImport.SetImportVoidPointer(pointer);
            _imageImport.SetDataSpacing(1, 1, 1);
            _imageImport.SetDataOrigin(0, 0, 0);
            _imageImport.Update();
            _texture.SetInputConnection(_imageImport.GetOutputPort());
            _texture.Update();
            pinnedArray.Free();

            _vtkActor.SetTexture(_texture);

```

---

<div class="post-metadata">

**Author:** ![LucasGandel](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lucasgandel/32/1831_2.png) [@LucasGandel](https://discourse.vtk.org/u/LucasGandel)\
**Post date:** [March 22, 2024, 9:12am UTC](https://discourse.vtk.org/t/render-method-doesnt-work-on-avalonia/13588/2 "2024-03-22T09:12:40Z")

</div>

Hi @yimadong,

Thank you very much for your interest in ActiViz, and thank you for the detailed question.

You can trigger a refresh by calling `RequestNextFrameRendering` on the control.  
Alternatively, calling Render on the interactor will also force a refresh.

Hope this helps;  
Thanks,  
Lucas
