0

非常に単純で基本的な問題がありますが、それを克服する方法がわかりません。snappedview をサポートしたいのですが、既にサポートしていますが、完全にはサポートしていません。

名前のあるコントロールを表示できません。たとえば、bing マップ コントロールがあります (これはバインディングでは機能しません...)。そのため、コード ビハインドで変更するには、名前とすべてのアクションを指定する必要があります。コントロールの例は次のとおりです。

<map:Map x:Name="map"
         Credentials="{StaticResource BingCredentials}"
         Tapped="Map_Tapped"
         Loaded="Map_Loaded">
         <map:Map.Children>
             <map:MapItemsControl ItemTemplate="{StaticResource PushpinLocalTemplate}" ItemsSource="{Binding PushpinModel}" />
         </map:Map.Children>
</map:Map>

そのため、複数のビュー (FullView または SnappedView...) で表示することはできません。問題は、データテンプレートに書き込むと、コードビハインドで名前にアクセスできないため、すべてのコードがコンパイルされないことです。

私に何ができる?多分ユーザーコントロール?はいの場合、どのように?

どうもありがとう!

4

1 に答える 1

1

これがお役に立てば幸いです。このサンプルは、スナップ ビューでマップを非表示にします。Visibility必要なプロパティとCollapsed目的の値を変更できます。マップの名前がCoolMapになっていることに注意してください。別の名前を使用する場合は、それも変更してください。

<common:LayoutAwarePage
    x:Class="BingMapsApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BingMapsApp"
    xmlns:map="using:Bing.Maps"
    xmlns:common="using:BingMapsApp.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <map:Map x:Name="CoolMap" Credentials="{StaticResource BingCredentials}">
            <map:Map.Children>
                <map:MapItemsControl ItemTemplate="{StaticResource PushpinLocalTemplate}" ItemsSource="{Binding PushpinModel}">
                    <x:String>blah blah blah</x:String>
                </map:MapItemsControl>
            </map:Map.Children>
        </map:Map>

        <VisualStateManager.VisualStateGroups>
            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>
                <VisualState x:Name="FullScreenPortrait" />

                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CoolMap" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>

を使用して任意のプロパティを変更しますObjectAnimationUsingKeyFrames

于 2013-09-28T19:40:26.063 に答える