Are there any way to make grid to not show over grid children?
I mean, I want grid lines to be visible, but when a children has rowspan or columnspan over 1, I want it to hide the grid lines.
I tried setting the children (it's a label) opacity to 1 but it didn't work.
Any help will be welcome.
No there is not. From MSDN:
Only dotted lines are available because this property is intended as a design tool to debug layout problems and is not intended for use in production quality code. If you want lines inside a Grid, style the elements within the Grid to have borders.
Related
I have a simple Silverlight (v5) Grid with a fixed number of rows and columns. On this grid, I'm positioning several UserControls (called myControl in this example) at specific "grid coordinates" e.g. row 2, column 1.
Occasionally, I need to move a myControl to a new grid position; I currently do this by
Grid.SetColumn(myControl, newColumn);
Grid.SetRow(myControl, newRow);
.. and this all works fine, myControl is moved to the new coordinates.
Just purely for eye candy, I'd like to animate myControl when it moves, so that it "slides" from the old grid position to the new one rather than just appearing. Is there an easy/quick way to do this?
For handling layout changes within an element to display a smooth transition FluidMoveBehavior is generally the option you would be looking for. While it won't animate things like size or visibility, it is however specifically for animating the offset of a child element moved around a parent container.
Glad you found your answer. Cheers
I have grid with some textboxes and an image which goes out of grid boundaries and I add this grids dynamically in my code to another grid.
I want to have my image on top of all the rest of the grids. Unfortunately each grid I add to the root grid will hover over my previous grid image.
Could you please suggest anything?! I have tried with zindex and it did not work in my case.
What I am doing wrong?
ZIndex only works for the immediate children of a panel-derived container (Grid, Canvas, Stackpanel etc). Otherwise it is down to the order they exist in the visual tree (i.e. the last one gets displayed on top).
If you have nested objects you simply need to think about the order they are added. The simplest way to do this is have two top level grids/panels, the first contains everything else and the last containing just the dynamically added children.
This way whatever you put in the second grid will always be on top of all other items (in the first grid/container).
I need to display a 1 pixel wide border around all wrap panel cells, kinda like excel grid. Unfortunately the wrap panel does not implement the grid ShowGridLines property. I can't put a border inside every cell because adjacent cells will have a 2 pixel border instead of 1 pixel.
Since the wrap panel arranges it's layout dynamically and does not expose it's properties I can't evaluate the correct value for a border inside a cell. Any workaround possible?
There is no way to show grid lines because it's just not a grid. Even in a WPF grid control, you have very little control over the appearance of lines: How can I change the color of the gridlines of a Grid in WPF?. They're really just for debugging. The workaround is to put a border inside each cell that only has thickness on the bottom and on the right: BorderThickness="0,0,1,1"
I am trying to fill the Grid control with custom controls dynamically. After the grid is filled with elements, I need to connect these elements by lines. How do I achieve this....
Thanks in advance
I have an idea you could try: Within a Grid, items will overlap each other. So you could create an outer Grid which contains your grid and also a Canvas with a transparent background. On the Canvas, you could draw lines which would look like they are connecting your Grid's elements.
You can use a Grid set as an ItemsPanel for an ItemsControl. It's not quite easy, but if that's the way you want to go.
For connecting elements by a line, here is a good article that shows you just that:
UI Frontiers: Thinking Outside the Grid (by Charles Petzold)
Does anyone know how to draw a line between two items in a grid? I would normally use a canvas but it does not provide the layout I want.
The grid is the ItemsPanel of an ItemControl object.
Thanks,
Adam
You have to do following things, Suppose you have three columns in the grid and one item is in the first column and second item is in the third column and you have to draw line between them. and I am supposing that all the columns of the grid has same width.
Write style for the button which only contain the line.
now set the left margin and right margin of the line ( which will be the button and style of the button , you have created as I have mention above), to the half size of the columns width, and set the columnSpan of the line button to 3.
Hope that will help.