How to set initial position based on dimensions?

I have the following code:

<App>
	<DockPanel>
		<Panel ux:Name="panel" Height="100" Background="#00f" Dock="Top"/>
	</DockPanel>
</App>

But I want to set the position of “panel” at the start so that it is exactly just off the screen, eg. something like this:

<Panel ux:Name="panel" Height="100" Y="-height(panel)" Background="#00f" Dock="Top">

(Then later I will slide the panel into view)

Is there a way that I can set the start position based on the height?

Thanks!

Yes, just add a Translation to it:

<App>
    <DockPanel>
        <Panel ux:Name="panel" Height="100" Background="#00f" Dock="Top">
        	<Translation Y="1" RelativeTo="Size" />
        </Panel>
    </DockPanel>
</App>
1 Like