MyRowControl.cs | Drag Object To Scroll In WPF C# | Amit Padhiyar | Saatody
MyRowControl.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.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Threading; namespace EffectFeatures { public class MyRowControl : Grid { private static Button AddRow = new Button(); public void Initialize() { try { this.Children.Clear(); Repaint(); Resize(); Event(); Refresh(); this.Children.Add(AddRow); } catch (Exception e) { } } public void Repaint() { try { } catch (Exception e) { } } public void Resize() { try { AddRow.Content = "Add Row"; AddRow.HorizontalAlignment = HorizontalAlignment.Left; AddRow.VerticalAlignment = VerticalAlignment.Top; AddRow.Margin = new Thickness(0, 0, 0, 0); AddRow.Width = 100; AddRow.Height = 20; } catch (Exception e) { } } public void Event() { try { AddRow.Click += (sender, e) => { MyRowTest.REC.AddRow(); }; } catch (Exception e) { } } public void Refresh() { try { this.LayoutUpdated += (sender, e) => { Resize(); }; DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 1); timer.IsEnabled = false; timer.Tick += (sender, e) => { Resize(); }; 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