Tell me, is it possible that Grid.RowDefinition , which has Height - Auto , somehow would not have seen this or that element, that is, would collapse just as if it were empty? But when other elements appear, then it will already display the invisible one along with them.

  • Just visibility to change the internal element does not help? - EvgeniyZ
  • @EvgeniyZ, of course, this can be done, but I would like the Grid to simply ignore some elements. I know very well that it would be possible to change the visibility from the code, or to write some converter, but I hope for a more elegant method) - Arthur Edgarov
  • You shouldn't do anything out of the code, the only thing is that there should be a bool property, that's all. Then you decide for yourself, or you change the size of the RowDefinition through the converter (for example in this way ), or you can RowDefinition all elements of this row to some Border / Grid or something like that and set Visibility="Collapsed" . This is just a couple of lines of code and I don’t think that this is some kind of crutch, quite a good way. Well, the alternative to all this is to write your RowDefinition . You decide ... - EvgeniyZ
  • @EvgeniyZ, I do UserControl , and the logic there is not very simple, so doing something in the code is perfectly acceptable. Another thing is that this particular task really should be solved from XAML, I think so. For your better understanding - we are talking about TextBlock s, which are in the lines, of which - 24, on a line for every hour of the day. Well, if there are no elements in this line (events, in the context of my control), then there is no sense to display it - Arthur Edgarov 10:39 pm
  • Redefine MeasureOverride and ArrangeOverride with your control so that it asks for 0 heights. Although your task still needs to be solved with the help of a trigger or a converter - Andrew NOP

0