This is the camera screen using the Rectangle for Augmented Reality:
<Grid x:Name=”LayoutRoot”>
<Rectangle Width=”640″ Height=”4开发者_开发技巧80″>
<Rectangle.Fill>
<VideoBrush x:Name=”ViewFinderBrush” />
</Rectangle.Fill>
</Rectangle>
</Grid>
Questions:
1) How do I place a textbox ontop of the Rectangle?
2) How to place map, pin, image ontop of the rectangle dynamically?
Any link of reference for placing object ontop of the Rectangle such as place a Pin for current Gps location?
Thanks
In XAML, you need to add the TextBox
control after the Rectangle
declaration in order for it to be in front:
<Grid>
<Rectangle Width="640" Height="480">
<Rectangle.Fill>
<VideoBrush x:Name=”ViewFinderBrush” />
</Rectangle.Fill>
</Rectangle>
<TextBox Height="80" Margin="10,10,0,0"></TextBox>
</Grid>
When placing objects dynamically to the Grid
, you add them as children and those will be automatically placed on top of the existing layout. You simply need to make sure that you are setting the proper margins.
For example, if you would need to add another TextBox
, you could do this:
TextBox t = new TextBox();
t.Height = 80;
mainRoot.Children.Add(t);
Where mainRoot
is the name of the host grid. The same applies to other controls that support the ability to set child controls.
精彩评论