Current filter:
                                You should refresh the page.
                                  • In RepositoryItemTrackBar, when i click on the TrackBar, it only move the button to the target position,and then it will finish all operations. I i want to drag with the button, I must reclick the button and hold the mouse button, and then it will enter the dragging state, I can change the value by move mouse.

                                    but I hope if I click on that Trackbar, it move the button to the clicked position, and then make the button enter the dragging state.

                                    in the demo video, it show this beahviour.

                                    this is my demo code:

                                    [C#]
                                    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors.Repository; namespace DXApplication18 { public partial class Form1 : DevExpress.XtraEditors.XtraForm { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { RepositoryItemTrackBar editor = new RepositoryItemTrackBar(); propertyGridControl1.DefaultEditors.Add(typeof(int), editor); propertyGridControl1.SelectedObject = new TestObject(); } } public class TestObject { public int TestValue { get; set; } = 10; } }

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                If I understand you correctly, you wish to change a track bar value by moving the mouse over a track bar without the necessity to hold the thumb button pressed. If so, to accomplish this task, handle the RepositoryItemTrackBar.MouseDown and RepositoryItemTrackBar.MouseMove events in the following manner:

                                [C#]
                                bool canDrag = false; private void Editor_MouseMove(object sender, MouseEventArgs e) { TrackBarControl trackBar = sender as TrackBarControl; TrackBarViewInfo viewInfo = trackBar.GetViewInfo() as TrackBarViewInfo; if(canDrag && viewInfo.TrackLineContentRect.Contains(e.Location)) { trackBar.EditValue = viewInfo.ValueFromPoint(viewInfo.ControlToClient(e.Location)); } } private void Editor_MouseDown(object sender, MouseEventArgs e) { TrackBarControl trackBar = sender as TrackBarControl; TrackBarViewInfo viewInfo = trackBar.GetViewInfo() as TrackBarViewInfo; if(e.Button == MouseButtons.Left && viewInfo.TrackLineContentRect.Contains(e.Location)) canDrag = !canDrag; }

                                Note that this approach uses the undocumented inner APIs that may be changed in the future.

                                Try this approach and let me know your results.

                                • bodong 09.20.2019

                                  thanks for your reply, but your solution can't solve my problem entirely. for example, if i click the trackbar, it will enter drag mode. but if i move the mouse out of the track bar area, it will stop drag.
                                  but if i click on the track button directly, when i move mouse out of that area, I can still move the track button ..
                                  you can check the video for this behaviour.

                                  test code:

                                  [C#]
                                  using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Repository; using DevExpress.XtraEditors.ViewInfo; namespace DXApplication6 { public partial class Form1 : DevExpress.XtraEditors.XtraForm { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { RepositoryItemTrackBar editor = new RepositoryItemTrackBar(); editor.Maximum = 100000; editor.Minimum = 0; propertyGridControl1.DefaultEditors.Add(typeof(int), editor); editor.MouseMove += Editor_MouseMove; editor.MouseDown += Editor_MouseDown; propertyGridControl1.SelectedObject = new TestObject(); } bool canDrag = false; private void Editor_MouseMove(object sender, MouseEventArgs e) { TrackBarControl trackBar = sender as TrackBarControl; TrackBarViewInfo viewInfo = trackBar.GetViewInfo() as TrackBarViewInfo; if (canDrag && viewInfo.TrackLineContentRect.Contains(e.Location)) { trackBar.EditValue = viewInfo.ValueFromPoint(viewInfo.ControlToClient(e.Location)); } } private void Editor_MouseDown(object sender, MouseEventArgs e) { TrackBarControl trackBar = sender as TrackBarControl; TrackBarViewInfo viewInfo = trackBar.GetViewInfo() as TrackBarViewInfo; if (e.Button == MouseButtons.Left && viewInfo.TrackLineContentRect.Contains(e.Location)) canDrag = !canDrag; } } public class TestObject { public int TestValue { get; set; } = 10; } }
                                • Svetlana (DevExpress Support) 09.20.2019

                                  As you can see in the MouseDown and MouseMove event handlers, I check if the mouse pointer belongs to a track bar line by using the TrackBarViewInfo.TrackLineContentRect property. That is why changing a value by moving the mouse operates only within these boundaries. If you wish to extend the dragging area, use the TrackBarViewInfo.Bounds property instead.