I want to make programmatically scrolling in GridView and prevent user from doing it by himself. I tried to do something like in code below:
GridView.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Hidden);
GridView.ScrollIntoView(GridView.Items[10]);
GridView.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
Unfortunately after disabling vertical scroll bar display of GridView back to first row.
EDIT: After all there was really simple solution. Instead of changing values of VerticalScrollBarVisibilityProperty I disabled VerticalScrollModeProperty.
I'm not getting your requirement clearly but it'd be better to use ScrollViewer on top of your gridview and scroll it programmatically using:
ScrollViewer.ScrollToHorizontalOffset(Offset Value);
Or using PropertyMetaData. You can also enable/disable the scrollviewer based on your requirements.
Related
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
I am creating a customized grid in windows phone. I had done with all, but I am unsuccessful in
changing the grid selected row background color. I had tried the rowbackground property and also changed rowbackground color in grid selection_changed event. But nothing helped. Grid is displaying some default color when the row is selected. I searched some forums and found xaml code but no use. Anybody help me with xaml code else programmatically?
Create a new Style / template using blend which specifies the desired colours for the selected visual state.
to do this, you are best off using Expression Blend. You should already have it installed as it comes as part of the wp7 sdk or toolkit.
In the objects and timeline select your grid.
If you can't see it add a temporary one somewhere and use that and remove it at the end.
With a grid selected, right click it and select Edit Template\Edit a Copy
Decide whether you want this to be local or reused and select appropriately.
This will then give you a copy ofthe styling that is used for this control.
Find the section VisualStateGroup - and somewhere in there you should find the Selected visual state.
Style this accordingly to what you are after.
Make sure you give this Style/template a suitable name and ensure your original grid points to this style, and it should then pick up the new selected row colour.
i want to create a custom control (like UITableView in iPhone) in .Net using c sharp so user can scroll using mouse or keyboard navigation keys. I also want to create event when user click on any row. Currently the possible control is Datagridview which seems to me correct but i want to know the other possible approaches. So please suggest or advice other alternative
The DataGridView does sound like it might fit your simple requirements, you can certainly scroll using the mouse or keyboard. Also there is the CellMouseClick which is fired when the user clicks the grid. This reports row and column index.
However, the iPhone UITableView is not multi-column. If you do not heen a grid-like layout (rows and columns), then DataGridView is overkill. You might want to consider ListBox instead. This has a SelectedIndexChanged event which can be used to detect row clicks.
I'm getting confusion. I'm set :
this.listView1.Enabled = false;
when i make do that listview's scroll bars are disabled, too. I want to see all listviewitems in listview with scroll bars when listview disabled. Please give me some advices. Thanks.
After a lot of comments, I'm assuming your listview, because of is updated often from many different threads, is flickering.
If so, one possible solution is to enable DoubleBuffering; this property anyway is protected so accessible only from descendant classes.
So you could:
Add a new class to your project and paste the code shown below
Compile
Drop new control from the top of the toolbox onto your form, replacing the old one
This could solve your problem.
using System;
using System.Windows.Forms;
class BufferedListView : ListView
{
public BufferedListView()
{
this.DoubleBuffered = true;
}
}
The idea is taken from this post on SO.
you can't scroll a disabled control, since scrollbars are part of the control itself (and it's disabled, so...).
if you want to scroll but not allow user to select anything, you could do this
this.listBox1.SelectionMode = SelectionMode.None;
if you want to revert it, you can set it to SelectionMode.One for single, or one of the other options for multiple selection allowance.
another (imho overcomplicated) option is making a user drawn ListBox.
You can't scroll a disabled control - but if you really need such a functionality, develop a user control.
Developing Custom Controls in C#
Hiding the scroll bar in CheckListbox
Writing your custom control step by step.
Maybe if you put your listview inside a Panel you can enable scrolling by setting up ScrollBars="Auto" on the Panel control
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.