Posts

Share:

Example Of UndoRedoManager V1_0_0 WPF C#

According to my  previous post , today I will give you an example of UndoRedoManager API. In this post, I created little WPF form. You can follow code from MainWindow.xaml And MainWindow.xaml.cs. MainWindow.xaml In MainWindow.xaml, I designed simple form that you can see in example. Here is Canvas2D which contain a rectangle with some default style (color, size, transformation). Where at right side of the canvas, I created some textbox(es) and label(s) as propeties for rectangle manupulation. These properties are... X Y Width Height Rotation Fill R (Red) Fill G (Green) Fill B (Blue) Fill A (Alpha OR Transparent OR Opacity) Stroke R (Red) Stroke G (Green) Stroke B (Blue) Stroke A (Alpha OR Transparent OR Opacity) Stroke Width (Thickness) <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Saatody" x:Class="Saatody.MainWindow"...

Create UndoRedoManager V1_0_0 For WPF C#

 In post, I will talk about undo and redo manager (UndoRedoManager.cs) for C# (WPF and WindowsForm both). It's works properly in WPF but, I can't take responsibility for WindowsForm. Because this functionality tested in WPF only. So, This is version V1_0_0 and the below is code of UndoRedoManager.cs. using System; using System.Collections.Generic; using System.IO; using System.Windows.Markup; using System.Xml; namespace Saatody { public class UndoRedoManager { public MainWindow Window { set; get; } private int Pointer = 0; private List<string> States = new List<string>(); public void RecordState(object State) { try { States.RemoveRange(Pointer + 1, States.Count - (Pointer + 1)); } catch(Exception Ex) { } States.Add(XamlWriter.Save(State)); Pointer = States.Count - 1; Window.Console.Text = "Record State (" ...

Create AutoScroll V1_0_0 for WPF C# | Saatody | Amit Padhiyar

 Today, I will discuss about AutoScroll algorithm. This is version V1_0_0 of AutoScroll algorithm. First see the algorithm's API. Then we will discuss about connectivity of this API with your program. namespace Saatody.Core.UI { public class AutoScroll { private enum ValueTypes { Increment, Decrement } private enum SpeedLevels { None, Normal, Medium, Extreme } public double None { set; get; } public double Normal { set; get; } public double Medium { set; get; } public double Extreme { set; get; } public double NormalDistance { set; get; } public double MediumDistance { set; get; } public double ExtremeDistance { set; get; } public double Mouse { set; get; } public double Point1 { set; get; } public double Point2 { set; get; } public double Speed ...

Custom Event In C# WPF | Saatody | Amit Padhiyar

 Today I will talk about... How to create custom event in C# WPF. First, We need a class which can contains our properties and events. private double x = 0.0; public double X { set { x = value; OnValueChanged(EventArgs.Empty); } get { return x; } } Here, We have a property in A class. Where OnValueChanged() is protected event method within A class. Follow below code. public EventHandler ValueChanged; protected virtual void OnValueChanged(EventArgs e) { EventHandler handler = ValueChanged; if (handler != null) { handler(this, e); } } Now we invented new event which name is ValueChanged. You can use this event as normal event in other class(es). For example B class. Follow below code. BClass.ValueChanged += (sender, e) => { System.Console.WriteLine("X: " + BClass.X); }; This how we created ValueChanged custom event in C# WPF. Note: Always use 'event' keyword before EventHandler. This how com...

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

 Today i will create Drag And Drop Operation. Actually, DevExpress GridControl support Drag and Drop in Views (TreeListView, TabelView, and CardView). But I am trying to drag GridControl row and drop on my custom UI. Here I will write about Drag and Drop with two clipboard operations. Drag Copy And Drop Drag Cut And Drop First set these two properties on GridControl And View (TreeListView, CardView, TableView). GridControl.AllowDrop = true; GridView.AllowDragDrop = true; GridView.AllowDrop = true; GridView.ShowDragDropHint = false; Due to ShowDragDropHint false, The hint will be disable and only cursor will change during DnD (Drag and Drop). First we create Drag Copy And Drop it is too simple to create drag and drop with copy data or element. We just prevent drag leave events using e.Handled = true. GridControl side coding GridControl.AllowDrop = true; GridView.AllowDragDrop = true; GridView.AllowDrop = true; GridView.ShowDragDropHint = false; GridView.StartRecordDrag += (sen...

Create Custom DockManager V1_0_0 Using DevExpress | C# | WPF | Saatody | Amit Padhiyar

In this post, I will try to create simple API structure for DockManager. Actually, The DockManager parent class will derive from DockLayoutManager (DevExpress WPF). But there, I will create simple steps to add DocumentPanel(s). And also, Create some default restrictions like FloatingMode for floating panels, DestroyOnClosingChildren for default DocumentGroup. This API is for private use only. This is version V1_0_0. And Specially created for DocumentPanel(s) restrictions and for "easy to add" features. using DevExpress.Xpf.Docking; using DevExpress.Xpf.Layout.Core; namespace Saatody.Core.UI { public class DockManager : DockLayoutManager { private LayoutGroup Root = new LayoutGroup(); private DocumentGroup DocumentGroup = new DocumentGroup(); private DocumentPanel PreviousDocumentPanel = new DocumentPanel(); public DockManager() { // Load Default Dock this.FloatingMode = FloatingMode.Desktop; ...

Create TreeView Using GridControl | DevExpress WPF | Saatody | Amit Padhiyar

Today i will create Advance TreeView using DevExpress GridControl Component. This code for WPF. So, It may contains XAML or Pure C# programmatically code. Actually GridControl contains many features like drag and drop, icons, adding and deleting rows. And main feature is it supports multiple columns. There can be many types of  GridControl for example TreeView, CardView, And TableView. But today, I will talk about TreeView Only. Here we needed two more class(es). These will custom class(es) as role of "Model" and "Data". The Data class contains property of GridControls or you can say simply as a columns. And, The Model class contains ObservableCollection of Data class. GridControl binding with  ObservableCollection's object using ItemsSource. See the below simple example. XAML <dxg:GridControl Name="GridControl" AutoGenerateColumns="AddNew"> <dxg:GridControl.View> <dxg:TreeListView/> </dxg:GridControl.View...