Here's my problem:
xaml file 1: a templated list control
<ItemsControl ItemSource={Binding myUIrelatedDataList}/>
<ItemsControl.ItemTemplate>
<DataTemplate>
<my:DynamicUIPresenter Width="160" Height="80"/>
<!-- here, I want to specify my desired size to which i want to
scale down the generated UIElements -->
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl/>
xaml file 2: the item template
<Border BorderBrush="Black" BorderThickness="1">
<Border Child="{Binding Path=., Converter={StaticResource DynaUIConverter}}"/>
</Border>
The problem is that I do not know anything about the myUIrelatedDataList
and what exact kind of UIElements the DynaUIConverter
is producing. The DynaUIConverter
usually produces a set of Stackpanels nested in each other and containing TextBoxes, Buttons, etc. These panels do not have a Width or Height set, which I might not be able to fix.
I think I need to measure the minimum size requirements of the generated UI and dynamically apply a ScaleTransform to the produced UI, or maybe better to the Border containing the generated UI.
I tried this in code behind, but the scaling did not work correctly, since I was not able to understand how/if width and height propagation from children to parents really works. And I also ran into some recursion problem, which made the code in the end quite inefficient.
The Question now is: Can I do this downscaling of a child element directly/easily in XAML?