Share:

RightEffectRowContainer.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody

RightEffectRowContainer.cs

Drag object using MouseLeftButtonDown, MouseLeftButtonUp and MouseMove. When we drag object using mouse and if object's any part is going outside parent panel then the parent panel margin automatically update and try to in that object.
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Input;
using System.Windows.Threading;

namespace EffectFeatures
{
    public class RightEffectRowContainer : Grid
    {
        public void Initialize()
        {
            try
            {
                this.Children.Clear();
                Repaint();
                Resize();
                Event();
                Refresh();
            }
            catch (Exception e) { }
        }
        public void Repaint()
        {
            try
            {
                LinearGradientBrush gradientBrush = new LinearGradientBrush(Color.FromRgb(100, 0, 0), Color.FromRgb(0, 0, 100), 0);
                this.Background = gradientBrush;
                //this.Background = new SolidColorBrush(Color.FromRgb(20, 15, 0));
            }
            catch (Exception e) { }
        }
        public void Resize()
        {
            try
            {

            }
            catch (Exception e) { }
        }
        public void Event()
        {
            try
            {

            }
            catch (Exception e) { }
        }
        public static double Left = 0.0;
        public void Refresh()
        {
            try
            {
                this.LayoutUpdated += (sender, e) => {
                    Resize();
                };
                DispatcherTimer timer = new DispatcherTimer();
                timer.Interval = new TimeSpan(0, 0, 0, 0, 0);
                timer.IsEnabled = false;
                timer.Tick += (sender, e) =>
                {
                    Left = this.Margin.Left;
                };
                timer.Start();
            }
            catch (Exception e) { }
        }
    }
}

Comments

Popular posts from this blog

Get Color From Pixel C# WPF | Saatody | Amit Padhiyar

Basic Audio Operations With MP3 And Wave Files Using NAudio C#

Create Drag And Drop Operation Between DevExpress GridControl And Custom WPF UI | Saatody | Amit Padhiyar