2013-06-07 2 views
1

VB에서 Callisto settingsflyout을 추가 할 사람이 있습니까? CS에 몇 가지 샘플이 있지만 VB 모드에서 샘플을 이해할 수 없습니다. 하나의 토글 스위치를 추가하고 참조 할 수 있도록 내 앱에 저장하려고합니다. 나는 VB와 XAML을 사용하고있다.샘플 Callisto 설정 VB에서 플라이 아웃

답변

1

이 내 App.XAML.VB에서 사용하는 것입니다 :

Private Sub addSettingsScenarioAdd() 

    AddHandler SettingsPane.GetForCurrentView.CommandsRequested, AddressOf onCommandsRequested 

End Sub 

Private Sub onSettingsCommand(command As IUICommand) 
    Dim settingsCommand As SettingsCommand = DirectCast(command, SettingsCommand) 
    Dim rootFrame As Frame = Window.Current.Content 
    rootFrame.Navigate(GetType(Page1)) 

End Sub 

Private Sub onCommandsRequested(sender As SettingsPane, args As SettingsPaneCommandsRequestedEventArgs) 
    Dim handler1 As New UICommandInvokedHandler(AddressOf onSettingsCommand) 

    Dim about = New SettingsCommand("about", "About", Sub(handler) 
                  Dim aboutpane = New SettingsFlyout() 


                  aboutpane.Content = New AboutPanel() 
                  aboutpane.IsOpen = True 
                  aboutpane.HeaderText = "About" 
                  aboutpane.Background = New SolidColorBrush(Colors.White) 
                  UserSettings.Values("isAboutOpen") = "yes" 
                 End Sub) 
    args.Request.ApplicationCommands.Add(about) 
End Sub 

을 그리고 다음 SettingsFlyout 수집 및 저장 설정 (예 : 앱에서 격리 된 저장소 또는 설치 속성에 저장할 수있는 컨트롤을 사용. 플라이 아웃 컨트롤에서 변경할 수있는 XAML.VB

시작해야합니다 (플라이 아웃 용 컨트롤을 만들어야합니다.이 플라이 아웃은 단지 페이지에서 올바른 크기/모양 인 사용자 정의 컨트롤 일 필요가 있습니다). 다음은 'aboutpanel'컨트롤의 예입니다.

<UserControl 
x:Class="ThisApp.AboutPanel" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:FootballHub" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" 
d:DesignHeight="480" Width="260" ManipulationMode="None"> 

<StackPanel > 
    <Grid Background="White" Margin="0,0,0,0" ManipulationMode="None"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="50"/> 
      <RowDefinition Height="50"/> 
      <RowDefinition Height="50"/> 
      <RowDefinition Height="50"/> 
      <RowDefinition Height="50"/> 
      <RowDefinition Height="250"/> 
     </Grid.RowDefinitions> 
     <TextBlock x:Name="VersionAndPublisherText" HorizontalAlignment="Left" Margin="10,0,0,0" Foreground="{StaticResource MainColour}" TextWrapping="Wrap" VerticalAlignment="Top" Height="40" Width="240" FontSize="12" Grid.Row="1" Text="Textblock" /> 
     <TextBlock x:Name="SupportHeadingText" Grid.Row="2" FontFamily="Global User Interface" FontSize="14" FontWeight="Bold" Foreground="Black" Margin="10,0" Text="Textblock" VerticalAlignment="Bottom" /> 
     <TextBlock x:Name="SupportText" Grid.Row="3" FontFamily="Global User Interface" FontSize="12" Foreground="#FF045DF6" HorizontalAlignment="Right" Width="240" Margin="0,0,10,0" Height="50" VerticalAlignment="Top" Text="Textblock" TextWrapping="Wrap" FontStyle="Italic" /> 
     <TextBlock x:Name="MainHeadingText" HorizontalAlignment="Left" Margin="10,0,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Bottom" Width="240" FontWeight="Bold" FontFamily="Global User Interface" Foreground="Black" FontSize="14"/> 
     <TextBlock x:Name="PrivacyHeadingText" Grid.Row="4" FontFamily="Global User Interface" FontSize="14" FontWeight="Bold" Foreground="Black" Margin="10,0" Text="Textblock" VerticalAlignment="Bottom" /> 
     <TextBlock x:Name="PrivacyText" Grid.Row="5" FontFamily="Global User Interface" FontSize="12" Foreground="{StaticResource MainColour}" HorizontalAlignment="Right" Width="240" Margin="0,0,10,0" Height="211" VerticalAlignment="Top" Text="Textblock" TextWrapping="Wrap" /> 
    </Grid> 
</StackPanel> 

버튼과 옵션 등을 추가하십시오.

나는 또한 내가 :, 그것의 대부분을 커버해야

AddHandler Me.Unloaded, AddressOf closing_AboutPanel 
    AddHandler Me.Loaded, AddressOf opening_AboutPanel 

을 등 설정을 적용 할 수 있습니다 닫는/내 패널 열 때 감지하는 핸들러를 사용합니다. 패널에 코드를 추가 할 때 입력을 받고 설정을 저장하는 것과 관련하여 다른 페이지 나 컨트롤처럼 코드를 처리 할 수 ​​있습니다.

+0

감사합니다. 도움이 될 것 같습니다. – Yosem

+0

당신이 그것에 갇혀 있다면 업데이트하십시오. 나는 그것이 원래 작동하도록 나이가 필요하다는 것을 기억한다. (하지만 지금은 모든 애플 리케이션에서 코드를 재사용 할 수있다.) – pumpkinszwan

관련 문제