Reputation: 3967
I'm trying to build an app which requires me to put some simple text in a fixed position (let's say that I'm trying to simulate a LockScreen).
This works while I'm in the design mode, but the TextBlock
changes position as soon as I run the app!
As you can see from the previous images, in design mode my TextBlock
overlays the background's one but, when the app runs, it's moved at the bottom of the screen.
The code is quite simple and I don't get what's happening!
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
<Image Source="/bvlczww3.bmp" Stretch="UniformToFill" />
<TextBlock x:Name="StaticDateBlock" Margin="32,645.263,0,0" TextWrapping="Wrap" Height="374.737" Width="550" FontSize="113" Text="11:03 Saturday January 5" MaxWidth="540" MaxHeight="390" UseLayoutRounding="False" FontWeight="Medium" LineStackingStrategy="BlockLineHeight" LineHeight="120" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Segoe WP SemiLight"/>
</Grid>
What's wrong with my code?
Upvotes: 0
Views: 812
Reputation: 10015
You should not use margins like this - Margin="32,645.263,0,0"
, XAML was invented as a smart-placement app, so you should use panels, grids etc for align needed components, not to use absolute coordinates. Try panels and perhaps it will fix your problem.
Upvotes: 0
Reputation: 698
adjust the Margin of the TextBlock control... because when the application run the control change its position with respect to application.
Upvotes: 1