WPF - overlay text on top of datagrid row - wpf

I have a WPF datagrid where certain rows will be disabled. In addition to disabling the cell contents, I'd like to present to the user some text that overlays the row with an explanation such as "Row disabled due to ...". Basically the same effect of having a label control with a lower z-order sitting directly in front of the datagrid row's cells.
If cell text spillover was possible (like in Excel), I could create a text column of 0 width with the message, then let the message runover through the neighboring cells. But to my knowledge this type of text spillover isn't possible in the datagrid.

If your rows have fixed height, you could add a another transparent datagrid on top of the other datagrid. The transparent datagrid would have one column which would show the disabled explanation. Simple but hacky solution.
The proper way would be to use adorners.

Related

Setting the background for cells with errors on selected row in Infragistics UltraGrid

I am working in WinForms with Infragistic's UltraGrid control. I want to make it so that my activated row shows cell's which have errors using a different background color than the rest of the row.
Currently, if the row is not activated, I see the errored cells with a red background, and the validated cells having a white background. However, when I select the row and it is activated, I cannot see which cells have errors any longer as the whole row has it's background set to yellow.
What I want to see is, that if the row is activated, all valid cells are yellow, and all invalid cells are red. If there are no invalid cells, then all cells are yellow.
Currently, I am de-activating the row if it is found to have an error. This works as long as the user doesn't click on the row again, which is a pretty lame assumption. I've looked into DisplayLayout.Override, which allows me to override at grid, band, row, column, and cell level, but when I override at the cell level it seems that the settings at the row level are still taking precedence.
Infragistics support suggested taking advantage of the ActiveAppearance and ActiveAppearanceEnabled properties on the cell itself, however, I'm stuck with an earlier version of Infragistics in which those properties were not implemented.
In the end I had to implement a custom draw filter for the cell using the IUIElementDrawFilter class. Examples of implementing IUIElementDrawFilter can be found at http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/html/Infragistics2.Win.v12.1~Infragistics.Win.IUIElementDrawFilter.html.

Data Grid View and Vertical scrollbars issue

I realized something annoying when using a data grid view control. When I try to set the cell's height by setting the RowTemplate height property to fit more records on the grid, the vertical scroll bar stops acting nicely and the grid doesnt display all the records (it only shows the records that fit on the available space plus one extra record!) until you resize the columns or something like that! But if I set the AutoSizeRowsMod property to AllCells the grid displays all the records, however the cell's height is now too big for me!
Is there a way to control the cell's height and still show all the records on the DGV? Does it even make sense that it's behaving this way?
Thanks

Datagrid row height doesnot shrink back

I have a data grid, in each row I have one cell which needs to have a very lengthy text which is about 1000 characters long. So I decided to put the text in the expander control keeping the cell width fixed, when the user wants to read the text, he clicks on the expander to open and reads it.
The row height automatically grows when the expander is expanded but when the expander is collapsed back, the row height doesnt shirk. Can anyone pls tell me how to set the row height back after the expander is collapsed?
i tried the follwing link.
http://forums.silverlight.net/forums/p/133177/299186.aspx#299186
but this did not work
any help would be grealty appreciated,
thanks
i was not able to solve this problem using SL control.
alternate solution to this is use silverlight telerik grid control. where we can solve the problem.

Horizontal ScrollBar in WinForms DataGridView

I'm using a DataGridView in VB.Net in VS 2005. The issue is, when there are rows that exceed the width of the DataGridView, the horizontal scroll bar doesn't appear (the ScrollBars property is set to "Both"), but an ellipsis appears at the end of each row that is too long. I don't want the ellipsis, but the horizontal scroll bar. The vertical scroll bar works as expected when the number of rows exceed the height of the DataGridView. Any ideas on how to resolve this?
I have tried setting numerous related properties (changing the AutoSizing property of the DataGridView, Resizability of the Row Template, made sure that no Columns were Frozen) to no avail.
Thanks!
Set the AutoSizeMode of the problematic column to AllCells.
This will resize the column header and force it to go out of the visible area thus displaying the horizotal scrollbar.
I just had the same issue. I had set the last column to Fill, so it was always resizing to fit to the visible area.

Spreading controls to fill space as a dialog resizes

I have a dialog with column down the right side filled with buttons. The dialog is built with Windows Forms. I have a mockup at the following link:original dialog
(I would have included it but apparently i'm not allowed to use image tags)
I would like for the buttons in the right column to resize themselves to fill the remaining vertical space when the dialog resizes. It doesn't particularly matter to me whether or not buttons simply increase in size or whether the buttons remain the same size while the gaps between them increase. I'm simply want the buttons to go from the top to the bottom. (I have a mockup for this as well but apparenlty i can only include one link)
I've tried hosting the buttons in a FlowLayoutPanel but they do not increase as the dialog stretches, I only get whitespace at the bottom after I run out of buttons. I also tried a TableLayoutPanel and had the same result but I may have misused it. Does anyone have any ideas how I could accomplish this?
Thanks in advance,
Jeremy
To get you started. Use the TableLayoutPanel, set its Anchor property to top, bottom, left, and right. Set the rows and columns to percentages as needed. I suggest each control have it own cell. Note that each control in a "cell" can have its Dock and Anchor property set as needed.
You can do this with a TableLayoutPanel. Create a column for the buttons, with each button having it's own row / cell in the column. Set each row to be an even percentage for height (if there are 10 buttons, each row would be 10%), and dock the TableLayoutPanel to the right side of the screen. Then, put the buttons into their rows and set them to full docking. Then, when the dialog expands, the TableLayoutPanel will expand to fill the entire right side of the screen, each row will adjust proportionally, and each button would expand to fit the new row size.
You may have to adjust this a bit to fit your needs, especially in how it relates to the other content in the window.

Resources