WPF Tabcontrol : Find number of rows created to show all tab headers - wpf

I have a dialog which shows a tab control, I have all the logic in place to figure out the largest tabitem it then this size is used to resize my dialog. It all works fine if I have a single row of tab items, if multiple rows get created then i am not able to calculate the height properly because I dont know how many rows of tabs were created.
How can I find out the number of rows that were created to render all tabs?
Update:
SizeToContent = SizeToContent.WidthAndHeight; works when I want the dialog to autosize, now I also want to have a fixed size dialog, here, I want to override the size of my tabitem content to be (dialog height - buttons below the tabcontrol - number of tabrows * tab row height), so the question still stands.
Also, SizeToContent leaves a single line at the bottom of my dialog, which disappears when you try to resize the dialog, I tried invalidating the visual, but it does not help, any ideas?

Related

How to increase the size of Gridview RepositoryEditText ? winforms devexpress

I used Repository EditText in Gridview to write description of some items. When i click enter button on keyboard, the new rows will comes to type but the height of the RepositoryEditText will not increase. If user Click enter button keyboard i need to extend the EditText height. I want to display both lines in same cell of gridview. How to complete my task ? Help me.
The TextEdit editor doesn't support the multi-line feature. So, you need to use MemoEdit as you already did. To display several lines, increase the GridView.RowHeight property, for example, to 60. On the other hand, in order to adjust a row height to completely display a cell content, enable the GridView.OptionsView.RowAutoHeight option.

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

Silverlight datagrid scrollbar size is wrong

I've got a Silverlight user control that contains a datagrid. The datagrid is bound to an ObservableCollection. The user control is displayed in a popup window that I show in response to some event in another control
There are about 80 objects in the collection, and I've set a fixed height of 400 on the datagrid, so only about 20 items can be shown at one time, and the vertical scrollbar should be shown, with a thumb size occupying about 1/4th of the control height.
However, what's actually happening is that the scrollbar occupies almost the whole control height; maybe 95% of it. The datagrid displays the first 20 items. When I click on the scrollbar down arrow, the scrollbar moves down a little to occupy the bottom 95% of the scroll area, and the datagrid displays the last 20 items.
It gets weirder. If I move over the items in the grid and scroll down using the mouse wheel, then the items scroll correctly and I can view the whole list, although the scrollbar remains the same size.
And then, if I close the popup and reopen it, the scrollbar now appears with the correct height and it works correctly.
Finally, if I just show the control directly on the page, and not in a popup, it works fine.
What's going on here?! Has anyone else run into this problem? Help!
Update: The problem seems to be the way that I'm showing the popup. For various reasons, I had to implement the popup display in a somewhat tricky way, and it's this that's causing the trouble.
I recoded this, removing some crufty stuff, and the problem went away; see my update. This isn't really a solution as such, but I wanted to close out the question for the record.

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.

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