Windows Phone 7 DIY Pop Up Alert
Before we get carried away, let’s go ahead and jump right in and see what we can come up with. Let’s create a new project for this example. Once done so we are ready to get our hands dirty.
In the ContentPanel section in our XAML file, we can go ahead and add a Rectangle control, which we will use as a container for our controls. Be sure to name the control as well as set the Visibility to Collapsed. We will then add a Border control to add a bit of styling and set the Alignment to Center.
We will also be setting the Brush and Background to the Static Resource. With the Border control you have the option of only adding one control within it, but we have a way to work around that.
We used over 10 web hosting companies before we found Server Intellect. They offer dedicated servers, and they now offer cloud hosting!
<Rectangle Name="disableRect"
Fill="#80000000"
Visibility="Collapsed"/>
<Border Name="formatDialog"
Background="{StaticResource PhoneChromeBrush}"
BorderBrush="{StaticResource PhoneForegroundBrush}"
BorderThickness="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="Collapsed"></Border>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="258" />
<ColumnDefinition Width="154" />
</Grid.ColumnDefinitions></Grid>
<StackPanel Name="radioButtonPanel"
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Center">
<RadioButton Content="I like Football."
Tag="I like Football."/>
<RadioButton Content="I like Video Games."
Tag="I like Video Games."/>
<RadioButton Content="I like to Develop."
Tag="I like to Develop." Height="74" Width="290" />
</StackPanel>
We chose Server Intellect for its cloud hosting, for our web hosting. They have managed to handle virtually everything for us, from start to finish. And their customer service is stellar.
<Button Grid.Row="1" Grid.Column="0"
Content="ok"
Click="OnOkButtonClick" />
<Button Grid.Row="1" Grid.Column="1"
Content="cancel"
Click="OnCancelButtonClick" />
<Button Content="Click Me!" Height="72" HorizontalAlignment="Left" Margin="120,491,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
For our Main Content Button we will be setting the Rectangle control, as well as our Border control Visibility equal to Visible.
private void button1_Click(object sender, RoutedEventArgs e)
{
disableRect.Visibility = System.Windows.Visibility.Visible;
formatDialog.Visibility = System.Windows.Visibility.Visible;
}
Server Intellect assists companies of all sizes with their hosting needs by offering fully configured server solutions coupled with proactive server management services. Server Intellect specializes in providing complete internet-ready server solutions backed by their expert 24/365 proactive support team.
private void OnCancelButtonClick(object sender, RoutedEventArgs e)
{
disableRect.Visibility = Visibility.Collapsed;
formatDialog.Visibility = System.Windows.Visibility.Collapsed;
}
private void OnOkButtonClick(object sender, RoutedEventArgs e)
{
MessageBox.Show(" You Clicked OK.");
OnCancelButtonClick(sender, e);
}
I just signed up at Server Intellect and couldn’t be more pleased with my fully scalable & redundant cloud hosting! Check it out and see for yourself.
WP7PopUpTut.zip