Using Callisto Library and SettingsFlyout !!!!

Ciao,
vediamo come utilizzare il controllo SettingFlyout messo a disposizione dalla Callisto Library per la nostra Settings Charm.

Partendo dal post precedente dove abbiamo parlato e visto come scaricare la Callisto Library ora proviamo ad utilizzarla per realizzare una
Settings Charm per le nostre Windows 8 Apps.

Qui ci mettiamo in ascolto sulla richiesta da parte dell’utente della Setting Pane:

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            SettingsPane.GetForCurrentView().CommandsRequested += OnSettingsPane_CommandsRequested;
            base.OnNavigatedTo(e);
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            SettingsPane.GetForCurrentView().CommandsRequested -= OnSettingsPane_CommandsRequested;
            base.OnNavigatedFrom(e);
        }

Nel delegato andiamo a definire la nostra SettingFlyout:

private void OnSettingsPane_CommandsRequested(SettingsPane sender,SettingsPaneCommandsRequestedEventArgs args)
{
SettingsCommand cmd = new SettingsCommand("", "", (x) =>
{
//nuova SettingsFlyout - CallistoLibrary
SettingsFlyout settings = new SettingsFlyout();

//Configurazione
settings.FlyoutWidth = Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth.Wide;
settings.HeaderBrush = new SolidColorBrush(Color.FromArgb(255, 139, 69, 19));
settings.HeaderText = "

"
settings.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(@"ms-appx:/Assets/BackgroundImage.png")) };

//Contenuto della SettingsFlyout
settings.Content = new SettingContent();

settings.IsOpen = true;
});
args.Request.ApplicationCommands.Add(cmd);
}

Molto rapidamente abbiamo configurato la nostra Settings Charm creando un nuovo SettingsCommand e definendo al suo interno una SettingsFlyout parte della Callisto Library.

In aggiunta come esempio ho creato una page di contenuto dedicata SettingContent fatta in questo modo:

<Page
x:Class=".SettingContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<TextBlock Text="" FontSize="28" Margin="10,0,0,0" />
<TextBox x:Name="" Width="400"
HorizontalAlignment="Left" Margin="10,0,0,0" />

Ecco il risultato finale:

Settings Charm

Settings Charm

Callisto library for Windows Store App

Ciao a tutti,
devo obbligatoriamente segnalare (per chi non fosse a conoscenza) e dopo aver lavorato direttamente con questo toolkit, che arriva in soccorso per lo sviluppo delle nostre Win 8 Apps.

Callisto è un appunto una library scaricabile liberamente da github oppure tramite NuGET.

Al suo interno troveremo oltre alla demo, diversi controlli, helper, converter, nati per semplificarci la vita … 🙂

Un breve elenco delle features presenti:

– Flyout (a primitive that includes positioning and ‘light dismiss’ logic)
– Menu (primarily to be used from AppBar, contains the base for providing, well, a Menu)
– MenuItem (an item for a menu, including separators and contains the command point for the menu item)
– SettingsFlyout (an item to create a custom settings pane UI)
– Rating (a ratings control for Metro UI)
– LiveTile (an in-app tile experience to give you animated or ‘live’ tiles)
– Tilt (an effect to provide the tilt experience when clicked on edges/corners)
– OAuth helpers (a set of helpers to create OAuth 1.0 signatures/headers for those sites that hate OAuth 2.0)
– BooleanToVisibilityConverter
– LengthToBooleanConverter
– RelativeTimeConverter
– Extensions

Onori agli sviluppatori di questo toolkit: Tim Heuer and Morten Nielsen.

Buon Win 8 App a tutti 🙂
Maurizio