C# Winrt在具有名称控件时如何支持SnapdView?
我有一个非常简单和基本的问题,但不知道如何克服它。 我想支持Snapdview,我已经支持了它,但不是完全支持 我无法显示具有名称的控件。 例如,我有一个bing地图控件(不使用绑定…)。所以我需要给它一个名字和每一个动作来改变它的代码。以下是控制示例:C# Winrt在具有名称控件时如何支持SnapdView?,c#,xaml,windows-store-apps,C#,Xaml,Windows Store Apps,我有一个非常简单和基本的问题,但不知道如何克服它。 我想支持Snapdview,我已经支持了它,但不是完全支持 我无法显示具有名称的控件。 例如,我有一个bing地图控件(不使用绑定…)。所以我需要给它一个名字和每一个动作来改变它的代码。以下是控制示例: <map:Map x:Name="map" Credentials="{StaticResource BingCredentials}" Tapped="Map_Tapped" Loa
<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或Snapdview…)。问题是,如果我在datatemplate中编写它,那么在代码隐藏中无法访问该名称,因此我的所有代码都无法编译
我能做什么?也许是用户控件?如果是,如何进行
非常感谢 我希望这有帮助,此示例在快照视图中隐藏地图。您可以更改所需属性的可见性,也可以更改所需值的折叠可见性。请注意,地图名为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
修改任何属性