Page 1 of 1

Dynamic Elements Scale

Posted: 11 Feb 2015, 16:15
by Nir Hasson
I've got custom items control container which uses a custom data template to display the hosted items.
I'd like to control the size of each item in order to support dynamic number of displayed items.

I've modified my custom data template to have binding to the ScaleX and ScaleY properties of the root grid Layout ScaleTransform .
When I launched the application I've noticed that the bindings don't work. The ScaleX and ScaleY properties of the ScaleTransform simply use their default value which is 1.. :(

Any suggestions how to dynamically control the scale of my elements?

Re: Dynamic Elements Scale

Posted: 11 Feb 2015, 18:13
by sfernandez
Could you please write a small piece of xaml so we can see the logical/visual tree. This way we can guess what could be happening.

Thanks.

Re: Dynamic Elements Scale

Posted: 11 Feb 2015, 19:28
by Nir Hasson
Here it is -
Note that the binding for the visibility property works well..

<DataTemplate x:Key="CubrDataTemplate">
    			<Grid x:Name="grid" Height="Auto" Width="Auto" Background="{x:Null}" Margin="1" Visibility="{Binding TraineeVisibility, Mode=OneWay}">
    				<Grid.LayoutTransform>
    					<TransformGroup>
    						<ScaleTransform ScaleX="{Binding TraineeLayoutScaleX, Mode=OneWay}" ScaleY="{Binding TraineeLayoutScaleY, Mode=OneWay}"/>
    						<SkewTransform/>
    						<RotateTransform/>
    						<TranslateTransform/>
    					</TransformGroup>
    				</Grid.LayoutTransform>    				
    				<Grid.ColumnDefinitions>
    					<ColumnDefinition Width="64"/>
    					<ColumnDefinition Width="100"/>
    					<ColumnDefinition Width="64"/>
    				</Grid.ColumnDefinitions>
    				<Grid.RowDefinitions>
    					<RowDefinition Height="40"/>
    					<RowDefinition Height="80"/>
    					<RowDefinition Height="40"/>
    				</Grid.RowDefinitions>
</Grid>
    		</DataTemplate>

Re: Dynamic Elements Scale

Posted: 11 Feb 2015, 19:48
by sfernandez
Something I forgot to ask, are you using 1.1 or 1.2 version?

And about the DataTemplate, is it used something like this?
<ItemsControl ItemsSource="{Binding Items}" ItemTemplate="{StaticResource CubrDataTemplate}"/> 

Re: Dynamic Elements Scale

Posted: 11 Feb 2015, 20:04
by Nir Hasson
I'm using 1.1 and the usage is exactly as you mentioned.

Re: Dynamic Elements Scale

Posted: 14 Feb 2015, 20:42
by sfernandez
I was able to reproduce the problem, we are looking into this issue.
I'll let you know when we found a solution.

Thanks for reporting.

Re: Dynamic Elements Scale

Posted: 16 Feb 2015, 12:14
by Nir Hasson
In the meanwhile I was able to make it work by finding the host UI Container and apply the layout transform explicitly to it...

Re: Dynamic Elements Scale

Posted: 16 Feb 2015, 13:05
by sfernandez
Ok, good to know.

Anyhow I found the source of the problem, so you will find this issue solved in the next release.