Now, we are going to create a new UserControl
to display a bonus gauge. In this case, we will use the previously created ScoreGauge
as a baseline to create this new gauge, making a few small changes.
1. Open the project
3DInvadersSilverlight
in Visual Studio or Visual C#.2. Select
ScoreGauge.xaml
in the Solution Explorer.3. Copy and paste the
ScoreGauge.xaml
. The IDE will add an item namedCopy of ScoreGauge.xaml
.4. Select the new item (
Copy of ScoreGauge.xaml
) in the Solution Explorer.5. Rename it to
BonusGauge.xaml
.6. Open
BonusGauge.xaml
(the XAML code) and replace the textScoreGauge
withBonusGauge
, as shown in the following line:x:Class="_3DInvadersSilverlight.BonusGauge"
7. Replace the text
tbkScore
withtbkBonus
, as shown in the following line:<TextBlock x:Name="tbkBonus" Margin="140,0,8,8" Text="0" TextWrapping="Wrap" FontFamily="./Fonts/Fonts.zip#3t" FontSize="48" TextAlignment="Right">
8. Open
BonusGauge.xaml.cs
and replace...