WPF Gridview Zindex - c#

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.

Related

Modifying DevExpress GridControl expand button

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

Windows Phone 8.1 - Programmatically scrolling in GridView

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.

C# WPF Selecting items in Grid

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.

How to make popup window auto populate with contents in cell

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.

Embedding non-edit widgets in a DataGridView

Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode?
For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the text.
We could create a custom cell and override the Draw method so that it draws the calendar in the cell, but that would not handle the mouse-over tool-tip that we already have in the existing calendar widget.
[Update]
I tried TcKs's suggestion, but was not able to create a working solution. See the comments on that answer.
You should derive your own type from DataGridViewColumn (e.g. a DataGridViewCalendarColumn) and return a DataGridViewCalendarCell (that you have to create yourself, too) as the CellTemplate.
A detailed description can be found in the MSDN article Build a Custom RadioButton Cell and Column for the DataGridView Control
You can instead of drawing calendar, take a calendar control, set them the grid as parent and set them same bounds ( left, top, width, height ) as cell has.

Categories

Resources