This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi There, I have DataGrid with one column binding to a Message Property of my ViewModel, this Message Property is string type and sometimes, the value of this Property is super long with at least 60 lines (separated with carriage return). Since the DataGrid will not show the whole message, we want to have some vertical scroll bar to be able to see the whole content. We tried use the following display template:
Or we use the following:
Nothing is working and we cannot see the whole contents at all. The attached is the screenshot to show the problem. Please help to solve the problem, either enable the content scroll (inside the cell) or the height of row to be as much as it needs and show the overall scroll inside the datagrid. Thanks, Gordon |
|
|
Hi Gordon, I tried your first code example in a simple DataGrid and it worked as I think you're expecting - The text wrapped around and caused the cell height to grow to fit all the text. The scrollbar is displayed, but is disabled due to all the text fitting. By setting a MaxHeight on the TextBox, I could cause the scroll bar to be usable of course. You may have a setting somewhere that is preventing this from working, though I'm not sure what that could be. The image you posted doesn't show the right hand side of the cell in question. Is there really no scroll bar displayed there? If you can, please provide more information about your DataGrid set up, or a repro project. -Jason Fauchelle |
|
|
Hi Jason, Yes, put MaxHeight on textbox will solve the problem: The scrollbar appears and work. But you said without setting MaxHeight on the textbox, "it cause cell height to grow to fit all the text" is not true. It grows to some extent, and then stop growing, and not all the text can be seen. I never can make the textblock with scrollviewer work (the 2nd code example). |
|
|
Hi Gordon, I think I know what you mean now. When you say "It grows to some extent, and then stop growing", does it happen to stop growing at the bottom of the DataGrid? I've had a look at using the available height of the DataGrid view window to limit the size of each cell which would cause the scroll bars to be displayed, but couldn't get it to work. The best option may be to set the MaxHeight on the TextBox. -Jason Fauchelle |
|