To be clear I'm talking about Grid - not GridView or DataGrid or anything like that.
All I found online was about GridView and such.
I want to be able to select items with a mouse click or drag from a Grid.
What I have is a table filled with text implemented through a Grid. I want to be able to select "cells" in the Grid.
The reason I don't use DataGrid is because I couldn't find a way to set a cell's span.
Thank you,
Dolev.
I had nearly the same approach some month ago: Dynamic ui with rows and columns
Maybe this will help you.
In the end I used Selector.IsSelected attached property.
Selector Class
I modified the MouseDown, MouseUp, MouseMove event to record a rectangle created when dragging the mouse while the left button is held. Then I checked which cells are within that rectangle.
As a double check to see that the cell is really selected I used Selector.SetIsSelected and Selector.GetIsSelected.
Related
I have created an array of ListBox in which I have populated with some data from a text file. I want to change between each Listbox when the user scrolls either left or right so each one can be displayed. How would I go about doing this? I have populated my user interface with the first List-box Listbox(0).
I don't fully understand your question, but if you are trying to put the scrollbar to the left side of the listbox, you can set the RightToLeft property to true.
If you want to move from one ListBox to another the better control to use is a Slider then a ScrollBar
I am new to DevExpress and I couldn't find a solution to modify the plus sign on nested gridviews.
Since some of my users have tablets they want to expand rows by touching the plus sign. However they are having hard times to touch exactly on the plus sign.
Is there any way to modify it to make it larger?
Changing size of the sign or changing the image completely is pretty fine for me.
Your ideas are welcome.
I suggest you to go through below reference links, These will provide you more details regarding your desired functionality:
To modifying Group Expand Button:
How to display an image in a group row
GridView.CustomDrawGroupRow Event
How to get skin's '+' icon for Custom Draw Group Rows
In case of Mater-Details:
For increasing the size of the Expand/collapse button:
Enlarge Exapnd/Collapse button of master detail view in xtragrid
master detail expand button size
If you want to change GridView's expand\collapse icon then you can
change it by modifying an image of the Grid | PlusMinusEx skin
element. Here is a code snippet illustrating how to replace the image
with your custom one in a currently applied skin.
Skin skin = GridSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Default);
SkinElement element = skin[GridSkins.SkinPlusMinusEx];
element.Image.SetImage(GetNewImage(), Color.Magenta);
LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
You can also paint the expand/collapse button on the CustomDrawCell
event handler. Please see the How to paint the master row's expand
buttons within the CustomDrawCell event in exactly the same manner
as the XtraGrid does KB article for more information.
References:
Draw custom expand/collapse button in GridView Row
Custom Draw +/- button for Master Detail GridView
Grid - How to change the master-detail expand button
XtraGrid:Adding a button to a cell that will allow cell data to expand - collapse.
Alternatively, you could use the TouchUIMode feature which make thing bigger and easier to use in a touch enabled environment. See this page :
https://documentation.devexpress.com/#WindowsForms/DevExpressXtraEditorsWindowsFormsSettings_TouchUIModetopic
Edit : there is also a touch optimized skin which you can see in this blog post :
https://community.devexpress.com/blogs/theonewith/archive/2011/12/29/build-for-beautiful-with-dxv2-metro-inspired-winforms-apps.aspx
So I have a vanilla DataGridView in a WinForms solution.
As you tab through the cells in the DataGrid eventually you reach a point where the selected cell is only half in view. In order to view it you must scroll over.
Well this is obviously something that I want to handle automatically so the question is....
How do I enable my DataGridView to scroll automatically as the user tabs.
I searched for a scroll bar index value or position value but couldn't seem to find anything.
DataGrid
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx
I think you are looking for something like FirstDisplayedCell to control your scroll.
dataGridView1.FirstDisplayedCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.firstdisplayedscrollingrowindex.aspx
I have a data grid displaying results from a sql database. What I want to do is make it so that when I double click on a cell in the datagrid, a new window appears where that cell can be edited. I also would like to have all the info for that cell to be autogenerated into editable fields when the cell is double clicked. Any help or links to tutorials is appreciated. Thanks.
Try this DataGridView.CellDoubleClick Event
Did you consider using data binding? Simply put, you can bind your items list to DataGrid, and current item (eg. selected/double clicked) to your edit form's controls (TextBox, Label and whatever else you might have there).
Here are good starting points for windows forms: #1, #2. They cover problem you're facing. You can find data binding tutorials for ASP/WPF easily too, but especially first link covers entire concept pretty well.
I have a datepicker control that I am using to set a date field in a gridview control, my datepicker shows a date and a button to display a calendar you can use to pick a date. This works great on its own but when I add this to a gridview the calendar pops up and the columns and rows cover up parts of the calendar. Setting the ZIndex for the calendar doesn't help because the other rows are on different panels? How can I get around this? I tried raising the ZIndex of the VisualParent but no luck.
Update, the gridview is very standard, 4 columns one of which is a date column, the datatemplate for that column creates a datepicker which initially looks like a text box and a button, the button is placed on a canvas panel and when clicked a calendar is added to the canvas. The canvas is the only panel that allows its children to stretch over its own boundaries so the button is 10 x 10 or so and the calendar is 200 x 200. When the calendar pops up it normally just covers up adjacent fields but when placed on a gridview each cell of the gridview that is "after" the datepicker covers up the calendar. I'm supposing I need to raise the zindex of my cell but I can't find a way to do this?
Could you provide more info about gridview and datepicker? Especially are they your custom controls or do they belong to any open source or commercial libraries or separate?
You also mentioned that DataTemplate has Canvas as a panel. Even though a Canvas can contain large elements, it does not necessarily show all of its children. This may or may not relate to your problem, though.
P.S. Sorry I had to post this as an answer. My reputation does not allow me to comment?
Wow, this should be done using a popup or an expander.