How to make xaml stackpanel have one or two colums - xaml

I want my stackpanel to display one or two rows, dependen on a bool value.
I want it to fill for both if there is only one.
how do I do that? - or should i use grid?

You should use a grid for this. There is many ways you can do this on. You can make a grid with 2 rows then set heigt to *. Or you can do this in code when the bool is true create a new row.
Here is how you can add row/columns in code.
programmatically add column & rows to WPF Datagrid

Related

Do not show partially visible rows in datagridview

I try to implement the following in winform vb net project (I see this work in an app written in delphi).
I wish to hide or set visibility to false of the bottom row that partially visible in dgv that is docked to fill.
I tried to implement something like this:
DataGridView1.Rows(DataGridView1.DisplayedRowCount(true) - 1).Visible = False
I think it should be called during DataBindingComplete and Resize/scroll events, but it doesn't work.
Do you have any ideas / solutions?
So what I use on one of my datagridviews is:
Dim ind As Integer = 0
ind = DataGridView1.Rows.Count - 1
DataGridView1.Rows(ind).Visible = False
which hides the last displayed row of the datagridview.
You requirement sounds somewhat odd. Your comment ”I wish to hide or set visibility to false of the bottom row that partially visible in dgv that is docked to fill.”... I am curious how you would know this is the last row? Is it not possible that there are more rows below the last one visible? If the scroll bars are available you should see the vertical one if rows go beyond its bounding box. If one of the rows is cut in half by the bounding box and there is more than 1 row below this row, then making invisible/hiding/deleting that row will simply move the next one up.
Since the DataGridView is docked you may have to resize the rows manually if you do not want the rows to be split by the bounding box. Another possible solution is to use the DataGridViews AutoSizeRowsMode Like below.
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
This will set the rows so that a row will not be chopped if it is outside the bottom of the bounding box. The rows will auto size to fit evenly There are seven (7) AutoSizeRowsMode options and I am guessing one of them may do what you are looking for. I am guessing DisplayedCells may work for what you describe. If the grid is re-sized often, you may have to implement this row resizing. Hope this helps.

Items should be arrange into three columns in CheckedListBox or listview or listbox

I have used CheckedListBox control in vb.net application.
I have several items as follow, item 1, item 2, item 3........item 100.
Now, i want all these items to arrange into three columns and then appear verticle scrollbar.
But, in CheckedListBox, it appears as horizontally. i want it to appear horizontally for just three columns and then vertical scroll should enable.
Can you please suggest if possible in CheckedListBox control or any other control and if possible then how i would have to set its property to achieve this.
I don't think you can do that in a CheckedListBox....
You could create a FlowLayoutPanel, with a fixed width and add AutoScroll = True.
Then add a number of CheckBox controls to it.
You could have problems regarding column alignment and margins. If that's the case, you can set the checkbox Autosize = False and make them a little larger (in order to contain the text)
Or you can reduce the Height of the checkboxes to reduce spaces (is this what you want?)
eg. Height = 15
Use repeat direction =horizontal and repeat column =3 for checkbox list

Invisible column in GridX?

Is it possible to create a column in GridX that will be invisible and not rendered? I don't want to simply hide cells with CSS because it's not elegant and it can have side effects.
Invisible columns are usefull, because for example, in onApply event from cell editor, I become a row data that contains only those fields from dataStore, that are declared as column.
Is there such feature in GridX as invisible column?
I'm using Dojo 1.9 with GridX 1.2.
There is a hidden columns module:
gridx/modules/HiddenColumns (version 1.2)
Hide columns and change the column array at the same time so that other grid features are not affected by hidden columns. That means, hidden columns can no longer be accessed through grid.columns() function.
Update -
I played around with the test GridX here and the least width it goes up to is 20px. However this email from one of the developers actually suggests that this might not be possible at all!
Earlier -
Have you tried building the grid with ColumnResizer module, and, selecting the required column, and, using the setWidth() method to set the width to zero? - this does NOT work.

NSTableView display selected row into NSTextField

I'm a still newbie in cocoa and I've already created NSTableView with buttons to add and remove selected rows. I added NSTextField label to display the values from selected row of the two columns.
Can anyone point me into right direction how to achieve this? I guess that it should work like this:
get selected row index number
get string value of both identifiers in selected row
set string value
also there should be if nothing is selected the string is empty I guess.
Found what I was looking for about the NSTableView bindings.
https://developer.apple.com/library/mac/#samplecode/NSTableViewBinding/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010522-Intro-DontLinkElementID_2

VB.Net - select whole line in a multicolumn ListView and not only first item

I have a ListView in VB.Net.
I want to use it to display a table of data.
However I want to be able to click on a row and select it.
The component allows me to select a row only by clicking on the first item of each row.
Can I change that?
Is there a better component to display tables? (I've already tried the DataGridView. I don't like it's appearance)
This should simply be a matter of setting FullRowSelect on the control to be True.
Change the FullRowSelect property to True.