How to force property binding

BitSmithy 2,206 Reputation points
2023-08-23T15:30:43.5566667+00:00

Hello,

I have binding defined in xaml:

                   Canvas.Left= "{Binding ElementName=ucUESelector, Path=RenderTransformOrigin, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ThRotationCenterPointConverter}, ConverterParameter=CanvasX}"
                   Canvas.Top= "{Binding ElementName=ucUESelector, Path=RenderTransformOrigin, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ThRotationCenterPointConverter}, ConverterParameter=CanvasY}"            

Now I want force app to trigger this binding code behind in case that binded proprty hasnt changed and binding isnt trigered automatically.

Is such possiblity?

Developer technologies Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 21,646 Reputation points
    2023-08-31T07:14:00.2833333+00:00

    Hello @BitSmithy ,

    If it also uses bind, maybe we can modify the value of RenderTransformOrigin in the ucUESelector_SizeChanged event to trigger UpdateSourceTrigger=PropertyChanged. What I mean is changing an extremely small value(If it is less than 0.0000001, it will not trigger) so that it has little impact on rendering.

    int count = 0;
    private void ucUESelector_SizeChanged(object sender, SizeChangedEventArgs e)
    {
                 
        if (count %2 == 0)
        {
           Renderpoint = new Point(Renderpoint.X + 0.0000001, Renderpoint.Y);
        }
        else
        {
            Renderpoint = new Point(Renderpoint.X - 0.0000001, Renderpoint.Y);
        }
        count++;
    }
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.