Hi,
I'm trying to use:
Field.PerformAutoSize(FieldAutoSizeOptions.DataCells, FieldAutoSizeScope.RecordsInView)
on a Field with a custom CellValuePresenter, but I could do with some guidance as to how this works, as I'm finding that some of my data is being truncated (no doubt due to some padding/margin values within the template).
Is there a way to shrink the field width to the largest (TextBlock) content AND keep a small amount of custom margin around that?
Regards,
Simon
Do you have an example that shows the problem? Auto sizing based on the cells in view is really just a product of measuring the cells visible within the datapresenter with an infinite width and using the desiredsize width.
I've attached a basic sample, where I've narrowed the problem down to be something to do with the usage of TestTrimming="CharacterEllipsis", and the FontFamily being set to Consolas.
In the sample, when these are set the second cell in row one seems to trigger the TextTrimming after the PerformAutoSize is carried out.
I'm not sure I follow. Here's what I see when I run using your window.
Perhaps I'm missing something but the columns are sized to the contents. If I resize the column larger I don't see any more data so it seems to be sized correctly.
I see from your screen shot that youy are running in Vista - when I run it in XP (luna chrome) I see: "156287.37236523..." - i.e. the TextTrimming has kicked in for some reason.
Can you provide a sample that demonstrates the problem?
Hello weavesi,
Have you found a solution to this problem? I have exactly the same problem (even if I don't use the same font as you).
Actually, I've just noticed from your screen shot that you are not using the same font as I am - Consolas (the zero would have a slash through it if you were).
You might not have it installed. We use it as our font of choice for numeric data (fixed pitch).
Well, my system info is:
OS: XP Pro 5.1.2600 (SP3); .Net: 3.5 SP1 + hotfixes -> 2.0.50727.3603
Unfortunately, there is not much I can do about that in my work environment.
Any ideas on a workaround though - here is what happens when I set the padding to 8,0,8,0 on the internal TextBlock - the text trimming has kicked in even though there is a big gap to the right.
I tried it in XP and it works there as well. Perhaps you're using an older version of the WPF framework on that XP system and there was a bug in that that is causing the issue?