I am a c# silverlight developer and i am under a situation where i have created GUI using c# only(no use of xaml) .
How i created this GUI :
I have coded for it in c# and there is 1 grid(with 3 number of rows) and inside that grid i have 3 more grids in each row of previous grid one corresponding to "Automatic Skewing" another grid in second row corresponds
to "Auto Model" and the third one corresponds to "Skew".
What i have to do ?:
Please note that the grid in third row contains a semi-transparent GUI. I want to do my gui semi transparent like this because i want to display the
GUI of the third row but i don't want to the user to click(edit) on third row , he must be able to see it with semi transparency (but can not click on it as you can see the third row (corresponding to skew) in snapshot below it is semi transparent and user cannot click on it).
How to achieve this using c# code only(not xaml). Any Idea ?
As you can see the Skew grid (3rd row) is semi transparent.
Based on your specification I think it would be the best to put all content of the third row into some container, set the IsEnabled property of it to false(as SilverLight's Grid seems to lack this property, you can try to wrap it in a ContentControl), and also set an Opacity lower than 1 to it.
Both the IsEnabled and the Opacity property affects the child elements.
Maybe it would be better to actually bind those values, as I suspect that the enabled/disabled state of the third row depends on some condition. (Both values - IsEnabled and Opacity - can be bound to the same condition, in case of the opacity you might want to use a converter)
By the way: I feel it would be much easier with XAML...
Related
I've found an answer that will let me set a row on a datagrid, although it seems a bit roundabout and hopefully unnecessary to do so - setting position of datagrid scrollbar
But before I go ahead and try to link my four DataGrids using this method (which I think is going to end up super messsy) I thought I'd ask - is there any way to neatly connect a scrollbar from one datagrid to another so that when I scroll down on Grid1 it'll scroll simultaneously on Grid2?
Assuming these grids will always have the same # of rows and columns
Or is there another way I should be constructing my views?!
I have two elements in the form, two GridViews.
Both of them are aligned horizontally at the same level.
When my form is resizing, I want both of them to change their width/ height according to the form size.
The problem is, if I try to anchor them, they kinda overlap at some point and I want to avoid that.
My question is, can I anchor one Grid View to the other Grid View and not to the form?
A solution can be a TabelLayoutLabel, but i don't really want to use this.
My question is, can I anchor one Grid View to the other Grid View and not to the form?
no you cannot, and if you could that would be bad practice.
the anchor property description by microsoft:
Gets or sets the edges of the container to which a control is bound
and determines how a control is resized with its parent.
a dataGridView is not a container it's a control.
it sounds like you should use a table layout panel, that would give you the best results.
search for it in the Toolbox:
make sure you set its property to Dock = fill, where ever you want, and
,
next. in the property of the table view, you enter Edit Rows And Columns
and set each column to the percentage that you desire
add your grids to each column,
and set each one's 'Dock' property to Fill, and there you go
you can undock the tableLayoutPanel and change its size,
Hope that was helpful
I am currently developping a slideshow viewer that should be able to display all of its images in a grid like display. However, this display has the following requirements :
It should show all items without having to scroll;
It should be able to handle resizing well (like the Grid control does);
I am using a ListBox, with its ItemPanel set to either WrapPanel or UniformGrid, but they didn't met the requirements : Wrap Panel isn't resizing its items to fill all available space ; UniformGrid gets closer to the desired result, but still leaves an empty space at the end of the last row (ie it should only add a row when it can entirely fill it)
I am therefore looking into a way of setting an UniformGrid so that there's no "blank" left at the end.
As an example, let's say I have three items in my collection, and the actual room to fit them all on one row ; the grid will still creates another row for the third one.
I am also open to solutions for that problem involving other controls, as long as they have a similar behaviour on item resizing and still show all of their items at once.
Thanks
We finally decided to go with a simple wrap with a variable width between items and to just deal with having to scroll if there's too many items.
The title pretty much describes what I am looking for. I have found answers that are close but not quite what I need. I am hoping someone can explain how to do this or point me in the right direction.
Current setup:
I have multiple user controls. Each contain a grid that has 5 rows and 3 columns. First row definition is set to Height="Auto" and the rest are Height="". First column definition is set to Width="Auto" and the others are set to Width="". I do not want the first row and first column to ever change size but I would like to have the rest of the grid scale.
Question:
I am trying to create a window, which contains a grid, that will dynamically size. The grid contains user controls stated above and each row and column in the window is set to *. I do not want any element in the window to size below what is required for the inner controls (i.e. I do want a button control change sizes but it should never become smaller then Auto width or height). Is there a way to allow for this scalability but do not get any smaller then what the controls requires (ideally within the xaml)?
I don't remember the exact CSS syntax, but I was hoping xaml had something similar to the way CSS sizes content equal to the size of characters on the screen (i.e. Min-Width: 1.5m;)
If you wanted the first row and column to be a static size then don't set them to auto, set the actual size then for the rest of the columns/rows you could use * so they all remain equal
I was wondering... I have a WinForms System.Windows.Forms.ListView with a bunch of ListViewItems that I'm drawing using the View.List style. Each ListViewItem has a "SmallIcon" that I fetch from the ListView's SmallImageList.
My problem is that the icons are showing too close to the border on the left. I've tried to change the bounds and the ListViewItem's Position property to no avail.
Is there anyway to have some kind of offset to ListViewItems?
The Win32 listview control doesn't have any setting to increase the space between the icon and the label (in any view, not just List). Setting ListViewItem.Position does nothing when the ListView is in List view.
A low-tech solution would be to simply prefix every ListViewItem's Text value with a single space. Slightly ugly, but oh so easy to do.
If you really want to have pixel level control, you will have to owner draw it. As always, if you are doing anything with a .NET ListView, ObjectListView makes owner drawing your items trivial.
As mentioned already, prefixing the text of all your items with a space is a super simple way to add padding. This has a pretty significant drawback, however. Once you do this, you lose the ability to find items in the ListView by simply starting to type their name while the ListView has focus.
Try adding white space to the left of your small images.
If you're using 16x16 images change to 24x16 for example by adding 8 white (or ListView Background color) pixels to the left.
If you are in ListView View LargeIcons then you can postion the text using item.position
A screenshot would be nice for an example to see exactly what you're after.
Funny thing... the Windows Explorer uses the ListView to display files and folders. i usually run my view in Report or Detail mode. i just switched it to List view mode and see the exact problem that you're describing! Yikes. Might be a bug with the Win32 object and that particular view type!
A quick workaround might be to use a Report style for the ListView with a single column or perhaps implement something yourself. The FlowLayoutPanel in .Net would work very nicely as a starting point for a custom list view.
As you are using the View.List style, I suspect you'll either need to implement some custom drawing or consider padding your images. You could also look at overriding the ListView control and manipulating it's bounds by overriding SetBoundsCore or SetClientSizeCore (or similar).
However, if the ListView were set-up for View.Details view, this could be done using the ListViewItem.IndentCount property:
The IndentCount property can be used
only when the View property of the
containing ListView is set to Details,
and the SmallImageList property of the
ListView is set. Source:MSDN
If you set the StateImageList property you can add a space of 16 px before the icons. I think you can adjust this additional space by loading an image with matching width as first entry into the StateImageList. But I have not tested this.
This thread discusses the opposite problem.