How to use in page?

2 posts, 0 answers
  1. Alex
    Alex avatar
    2 posts
    Member since:
    Jan 2013

    Posted 03 Feb 2013 Link to this post

    How do I actually get this to work in a page? I've tried to insert it as I would a normal control from the toolbox menu but cannot find it and when I try to add it to the menu I still cannot find it?

    Edit: Now on page in xaml but causes an exception when I try to set the isrunning to true:

        FontFamily="{StaticResource PhoneFontFamilyNormal}"
        FontSize="{StaticResource PhoneFontSizeNormal}"
        Foreground="{StaticResource PhoneForegroundBrush}"
        SupportedOrientations="Portrait" Orientation="Portrait"
                <shell:ApplicationBarIconButton x:Name="btnLogin" IconUri="/Icons/check.png" IsEnabled="True" Text="login" Click="btnLogin_Click" />
        <Grid x:Name="LayoutRoot" Background="Transparent">
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            <telerikPrimitives:RadBusyIndicator x:Name="busybar" Grid.RowSpan="2" AnimationStyle="AnimationStyle9" Foreground="{StaticResource PhoneAccentBrush}" Background="{StaticResource PhoneBackgroundBrush}" Canvas.ZIndex="1" />
            <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
                <TextBlock Text="Cloud Connect - Rackspace Edition" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
                <TextBlock Text="Login" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
            <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <TextBox x:Name="txtUsername" HorizontalAlignment="Left" Height="72" Margin="0,214,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="456"/>
                <PasswordBox x:Name="txtPassword" HorizontalAlignment="Left" Margin="0,317,0,0" VerticalAlignment="Top" Width="456"/>
                <RadioButton x:Name="radioUK" Content="UK Account" HorizontalAlignment="Left" Margin="10,389,0,0" VerticalAlignment="Top" Width="216"/>
                <TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="142" Width="436">
                    <Run Text="Welcome to Cloud Connect for the Rackspace Cloud. To begin, please enter your Rackspace login information to continue. We never share or read your login information and your login details are stored securely "/>
                    <Run Text="on your phone."/>
                <TextBlock HorizontalAlignment="Left" Margin="10,187,0,0" TextWrapping="Wrap" Text="Rackspace Cloud Username:" VerticalAlignment="Top" Height="27" Width="436"/>
                <TextBlock HorizontalAlignment="Left" Margin="10,290,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="27" Width="436">
                    <Run Text="Rackspace Cloud "/>
                    <Run Text="Password"/>
                    <Run Text=":"/>
                <RadioButton x:Name="radioUS" Content="US Account" HorizontalAlignment="Left" Margin="231,389,0,0" VerticalAlignment="Top" Width="215" IsChecked="True"/>

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Xml;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Shell;
    using Telerik;
    using Cloud_Connect_for_Rackspace.Resources;
    namespace Cloud_Connect_for_Rackspace
        public partial class MainPage : PhoneApplicationPage
            WebClient wc;
            public Rackspace api = App.api;
            public MainPage()
            private void btnLogin_Click(object sender, EventArgs e)
                busybar.IsRunning = false;
                busybar.IsRunning = true;
                wc = new WebClient();
                wc.Headers["Accept"] = "application/xml";
                wc.Headers["Content-Type"] = "application/json";
                wc.UploadStringCompleted += new UploadStringCompletedEventHandler(parseAuthResponse);
                    string json = "{\"auth\":{\"passwordCredentials\":{\"username\":\"" + txtUsername.Text + "\", \"password\":\"" + txtPassword.Password + "\"}}}";
                    if (radioUK.IsChecked == true) wc.UploadStringAsync(, HttpMethod.Post, json);
                    else wc.UploadStringAsync(, HttpMethod.Post, json);
                catch (NullReferenceException)
                    MessageBox.Show("Please enter your username and password to continue. These are the ones you use to login to the Rackspace Cloud online control panel", "Login Details Missing", MessageBoxButton.OK);
            void parseAuthResponse(object sender, UploadStringCompletedEventArgs e)
                    StringReader stream = new StringReader(e.Result);
                    XmlReader reader = XmlReader.Create(stream);
                    while (reader.Read())
                        if (reader.NodeType == XmlNodeType.Element)
                            if (reader.Name == "token")
                                // Store Token for Later...
                                api.auth.token = reader.GetAttribute("id");
                                // Get tenant ID to build URL's...
                                string tenant = reader.GetAttribute("id");
                                api.auth.tenant = tenant;
                                NavigationService.Navigate(new Uri(@"/Overview.xaml", UriKind.Relative));
                catch (WebException r)
                    MessageBox.Show("Unknown error. Please try again and check your internet connection");

    StackTrace  "   at Cloud_Connect_for_Rackspace.MainPage.btnLogin_Click(Object sender, EventArgs e)
       at Microsoft.Phone.Shell.ApplicationBarItemContainer.FireEventHandler(EventHandler handler, Object sender, EventArgs args)
      at Microsoft.Phone.Shell.ApplicationBarIconButtonContainer.ClickEvent()
      at Microsoft.Phone.Shell.ApplicationBar.OnCommand(UInt32 idCommand, Boolean isButton)
      at Microsoft.Phone.Shell.Interop.NativeCallbackInteropWrapper.OnCommand(UInt32 idCommand, Boolean isButton)"  string

    When I check, busyidicator is returning a null reference?
  2. Deyan
    Deyan avatar
    2026 posts

    Posted 06 Feb 2013 Link to this post

    Hi Alex,

    Thanks for contacting us and for the provided snippets.

    Normally, RadBusyIndicator is put over the contents you would like to disable when its IsRunning property is set to true. As with any other Silverlight control, you put it on a page, assign it a x:Name property and access it in the code-behind file. This should work just fine.

    However, it seems that in your scenario something different happens and since I cannot exactly say what it is based on the snippets you are sending here, I would like to kindly ask you to prepare a sample project in which the issue is reproduced and send it to me for further investigation.

    You will need to open a new support ticket in order to be able to upload files.

    Thanks for your time.

    Kind regards,
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top