RightEffectRow.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
RightEffectRow.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.Collections.Generic; using System.Windows.Threading; namespace EffectFeatures { public class RightEffectRow : Grid { public RightEffect RE = new RightEffect(); public static UIElement UI = new UIElement(); public void Initialize() { try { this.Children.Clear(); Repaint(); Resize(); Event(); Refresh(); UI = this; this.Children.Add(RE); RE.Initialize(); } catch (Exception e) { } } public void Repaint() { try { } catch (Exception e) { } } public void Resize() { try { } catch (Exception e) { } } public void Event() { try { } catch (Exception e) { } } public void Refresh() { try { DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 0); timer.IsEnabled = false; timer.Tick += (sender, e) => { if (RE.EventCommand == "Down") { // X1 System.Console.WriteLine("1] : " + RE.Margin.Left); System.Console.WriteLine("2] : " + (-RightEffectRowContainer.Left)); if (RE.Margin.Left <= (-RightEffectRowContainer.Left)) { MyRowTest.Go(RightEffectRowContainer.Left + ((-RightEffectRowContainer.Left) - RE.Margin.Left)); System.Console.WriteLine("---------------------"); } // X2 double X2 = RE.Margin.Left + RE.ActualWidth; double ViewX2 = (-RightEffectRowContainer.Left) + 1400; if (X2 >= ViewX2) { MyRowTest.Go(RightEffectRowContainer.Left - (X2 - ViewX2)); } } }; timer.Start(); } catch (Exception e) { } } } }
- MainWindow.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- MyRowControl.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- MyRowTest.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- MyColor.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- RightEffectControl.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- RightEffectRowContainer.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- RightEffectRow.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
- RightEffect.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
Comments
Post a Comment