How to redraw or refresh in OnRender?

前端 未结 4 787
臣服心动
臣服心动 2021-01-01 03:18

I want to draw something dynamically. Following code shows my OnRender. I\'m setting DrawItem somewhere in my program where I need it. But when I\'m calling DrawItem =

4条回答
  •  温柔的废话
    2021-01-01 03:45

    Your question is not clear but from what I can understand you seem to be asking for a method to refresh the visuals after updating your drawing variables. You could use the following after updating your drawing variables:

    this.InvalidateVisual();
    

    and with the property:

    private int drawItem;
    pulic int DrawItem
    {
     get {return drawItem;}
     set 
     {
        drawItem=value;
        this.InvalidateVisual();
     }
    }
    

提交回复
热议问题