Tuesday, February 26, 2013

HexaDecimal Color Codes

Black - #000000
Blue -   #0000ff
Brown - #a52a2a
Cyan -  #00ffff
DarkBlue - #0000a0
Fuchsia - #ff00ff
Green - #008000
Grey - #808080
LightBlue - #add8e6
Lime - #00ff00
Maroon - #800000
Olive - #808000
Orange - #ffa500
Purple - #800080
Red - #ff0000
Silver - #c0c0c0
White - #ffffff
Yellow - #ffff00

popup lightdismissal in windows store


Wrirte this code in Mainpage.xaml.
< Popup x : name = popup IsLightDismissEnabled = true >
< Popup . ChildTransitioins >
< TransitionCollection >
< PaneThemeTransition />
< /TransitionCollection >

<Border x : Name = PopupBorder Thickness = 6 Background = "#FF72A4EC"> < TextBlock x : Name = "tb" Text = "This is a popup with lightdismissal" />
 </Border>
< /Popup>  


Write this code  in Mainpage.xaml.cs.

if (!Popup.IsOpen)
                {
                    PopupBorder.Width = 658;
                    PopupBorder.Height = 100;
                    Popup.HorizontalOffset = Window.Current.Bounds.Width - 658 ;
                    Popup.VerticalOffset = 90;
                    Popup.IsOpen = true;

                }
              

                 
           
           
               
           
 


Friday, February 22, 2013

settingspane in windows store apps

OPen App.xaml.cs page and follow the below steps.

First thing you should do is to add callisto reference to your app or project references node and the namespaces shown below in bold and underlined.
Then you add two usercontrols to your project. In this code I named two usercontrols  as AboutUserControl and  PrivacyPolicyUserControl.
Then add the following code which highlighted in bold underlined.


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.UI;
using Windows.UI.ApplicationSettings;
using Callisto.Controls;

// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227

namespace CountryInformation
{
    /// Provides application-specific behavior to supplement the default Application class.
    sealed partial class App : Application
    {
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        ///
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }
        private Color _background = Color.FromArgb(255, 24, 0, 82); 
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        ///
        /// Details about the launch request and process.
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;


            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }

        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        ///
        /// The source of the suspend request.
        /// Details about the suspend request.

        private void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            //TODO: Save application state and stop any background activity
            deferral.Complete();
        }

        void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)

        {


            // Add an About command

            var about = new SettingsCommand("about", "About", (handler) =>
            {

                var settings = new SettingsFlyout();

                settings.Content = new AboutUserControl();

                settings.HeaderBrush = new SolidColorBrush(_background);

                settings.Background = new SolidColorBrush(_background);

                settings.HeaderText = "About";

                settings.IsOpen = true;



            });

            args.Request.ApplicationCommands.Add(about);

            var privacypolicy = new SettingsCommand("privacypolicy", "Privacy Policy", (handler) =>
            {

                var settings = new SettingsFlyout();

                settings.Content = new PrivacyPolicyUserControl();

                settings.HeaderBrush = new SolidColorBrush(_background);

                settings.Background = new SolidColorBrush(_background);

                settings.HeaderText = "Privacy Policy";

                settings.IsOpen = true;



            });

            args.Request.ApplicationCommands.Add(privacypolicy);

            var accounts = new SettingsCommand("accounts", "Accounts", (handler) =>
            {

                var settings = new SettingsFlyout();

                settings.Content = new PrivacyPolicyUserControl();

                settings.HeaderBrush = new SolidColorBrush(_background);

                settings.Background = new SolidColorBrush(_background);

                settings.HeaderText = "Accounts";

                settings.IsOpen = true;



            });

            args.Request.ApplicationCommands.Add(accounts);

        }