Why custom ItemsControl does not show anything? #17337
-
I need to create a custom control based on ItemsControl. So, I have a data item of the following type:
I have a blank CustomItemsControl:
and here is a markup I'm expecting to work, that currently shows the empty blank screen at runtime:
Funny enough the similar markup is perfectly working with traditional ItemsControl: I already tried to use DrawingContext to draw pictures and it works, but I need these pictures to by rotate-transformed from time to time while DrawingContext freezes them in initial state. So, can anybody explain how to instruct custom ItemsControl to display the data by means of data binding and ContentPresenter? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
All You may also need to change |
Beta Was this translation helpful? Give feedback.
All
TemplatedControl
s require aControlTheme
with its type key by default. Without that, Avalonia cannot render a visual. If you want to use the sameControlTheme
asItemsControl
, then you want to useStyleKeyOverride
. Otherwise, define and add your ownControlTheme
.You may also need to change
<ItemsControl.ItemTemplate>
(and the other children) to<cc:CustomItemsControl.ItemTemplate>
.