Wpf Dragging a rectangle on a canvas causes it to flash/blink

I am trying to drag a rectangle on an empty canvas. However, when i drag it, it flashes/blinks constantly.

I put a debug and the x and y coordinates jump between where my mouse cursor currently is and several drags? behind? if that makes sense?

Example:

Update X: 638, Update Y: 382.66666666666663

Update X: 319.33333333333337, Update Y: 302.66666666666663

Update X: 638, Update Y: 382.66666666666663

Update X: 319.33333333333337, Update Y: 302.66666666666663

The issue now is in this area i think:

Canvas.Left="{Binding SelectionRectangle.X}"
Canvas.Top="{Binding SelectionRectangle.Y}"

If i set it to static numbers, the blinking stops but i cannot create a rectangle from any starting point.

Here is my View:

<Window x:Class="PdfPageTagger.Views.CanvasWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:PdfPageTagger.Views" 
        mc:Ignorable="d"
        Loaded="Window_Loaded"
        xmlns:vm="clr-namespace:PdfPageTagger.ViewModels"
        Title="Canvas Viewer" >
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </Window.Resources>
    <DockPanel Margin="10">
        <Grid DockPanel.Dock="Top" Margin="10,0,10,10">
            <Grid.RowDefinitions>
                <RowDefinition Height="9*"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Canvas x:Name="viewCanvas"  Background="Black"
                                    MouseLeftButtonDown="Canvas_MouseLeftButtonDown"
                                    MouseMove="Canvas_MouseMove"
                                    MouseLeftButtonUp="Canvas_MouseLeftButtonUp">
                <Rectangle Stroke="Red" StrokeThickness="2"
                       Visibility="{Binding IsDrawing, Converter={StaticResource BooleanToVisibilityConverter}}"
                       Canvas.Left="{Binding SelectionRectangle.X}"
                       Canvas.Top="{Binding SelectionRectangle.Y}"
                       Width="{Binding SelectionRectangle.Width}"
                       Height="{Binding SelectionRectangle.Height}"/>
            </Canvas>
        </Grid>
    </DockPanel>
</Window>

Here is the xaml.cs behind my view:

public partial class CanvasWindow : Window
{
    public CanvasWindow()
    {
        InitializeComponent();
        var vm = new CanvasWindowViewModel();
        DataContext = vm;
        vm.OnRequestClose += (s, e) => this.Close();
    }

    private async void Window_Loaded(object sender, RoutedEventArgs e)
    {
        // Get the ViewModel instance from the DataContext
        if (DataContext is CanvasWindowViewModel viewModel)
        {
            await viewModel.WindowLoaded();
        }
    }

    private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        var viewModel = DataContext as CanvasWindowViewModel;
        if (viewModel != null)
        {
            viewModel.StartDrawingCommand.Execute(e);
        }
    }

    private void Canvas_MouseMove(object sender, MouseEventArgs e)
    {
        var viewModel = DataContext as CanvasWindowViewModel;
        if (viewModel != null)
        {
            viewModel.UpdateDrawingCommand.Execute(e);
        }
    }

    private void Canvas_MouseLeftButtonUp(object sender, MouseEventArgs e)
    {
        var viewModel = DataContext as CanvasWindowViewModel;
        if (viewModel != null)
        {
            viewModel.EndDrawingCommand.Execute(e);
        }
    }
}

Here is my ViewModel:

public class CanvasWindowViewModel : INotifyPropertyChanged
    {
        public ICommand StartDrawingCommand { get; }
        public ICommand UpdateDrawingCommand { get; }
        public ICommand EndDrawingCommand { get; }

        public CanvasWindowViewModel()
        {

            StartDrawingCommand = new DelegateCommand<MouseButtonEventArgs>(StartDrawing);
            UpdateDrawingCommand = new DelegateCommand<MouseEventArgs>(UpdateDrawing);
            EndDrawingCommand = new DelegateCommand<MouseButtonEventArgs>(EndDrawing);
        }


        private Rect _selectionRectangle;
        public Rect SelectionRectangle
        {
            get => _selectionRectangle;
            set
            {
                _selectionRectangle = value;
                RaisePropertyChanged(nameof(SelectionRectangle));
            }
        }

        private bool _isDrawing;
        public bool IsDrawing
        {
            get => _isDrawing;
            set
            {
                _isDrawing = value;
                RaisePropertyChanged(nameof(IsDrawing));
            }
        }

        private Point _startPoint;
        private void StartDrawing(MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                _startPoint = e.GetPosition(e.Source as IInputElement);
                SelectionRectangle = new Rect(_startPoint, new Size(0, 0));
                IsDrawing = true;
                Debug.WriteLine($"Start X: {_startPoint.X}, Start Y: {_startPoint.Y}");
            }
        }

        private void UpdateDrawing(MouseEventArgs e)
        {
            if (IsDrawing)
            {
                var currentPoint = e.GetPosition(e.Source as IInputElement);
                var x = Math.Min(currentPoint.X, _startPoint.X);
                var y = Math.Min(currentPoint.Y, _startPoint.Y);
                var width = Math.Abs(currentPoint.X - _startPoint.X);
                var height = Math.Abs(currentPoint.Y - _startPoint.Y);
                SelectionRectangle = new Rect(x, y, width, height);
                Debug.WriteLine($"Update X: {currentPoint.X}, Update Y: {currentPoint.Y}");
            }
        }

        private void EndDrawing(MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Released)
            {
                IsDrawing = false;
                Debug.WriteLine("Drawing Ended");
            }
        }

        public ObservableCollection<ImageSource> Pages { get; } = new ObservableCollection<ImageSource>();

        public event EventHandler OnRequestClose;

        public async Task WindowLoaded()
        {

        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật