public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if ((this.rootElement != null) && this.rootElement.Children.Contains(this.Popup))
{
this.rootElement.Children.Remove(this.Popup);
}//Map变化
this.rootElement = base.GetTemplateChild("RootElement") as Grid;
if (this.rootElement == null)
{
throw new ArgumentException(ExceptionStrings.RootElementIsNull);
}
Uri source = null;
if (((!this.isDesignMode && (source != null)) && (source.IsAbsoluteUri && !source.Scheme.Equals(Uri.UriSchemeHttp))) && !source.Scheme.Equals(Uri.UriSchemeHttps))
{
this.CreateErrorMessage(ExceptionStrings.SchemeError);
}
else
{
this.backgroundWindow = new Grid();
this.backgroundWindow.Background = new SolidColorBrush(Color.FromArgb(0, 0xff, 0xff, 0xff));
this.rootElement.Children.Add(this.backgroundWindow);
this.rotateTransform = new RotateTransform() { Angle = this.Angle };
this.transformCanvas = new Canvas()
{
RenderTransform = this.rotateTransform,
RenderTransformOrigin = new Point(0.5, 0.5)
};
this.rootElement.Children.Add(this.transformCanvas);
this.layerCollectionContainer = new Canvas();
this.transformCanvas.Children.Add(this.layerCollectionContainer);
if (base.FlowDirection == FlowDirection.RightToLeft)
{
this.transformCanvas.HorizontalAlignment = HorizontalAlignment.Right;
}
this.panHelper = new PanAnimation(this.layerCollectionContainer);
this.panHelper.PanAnimationCompleted += this.panHelper_PanAnimationCompleted;
this.panHelper.Panning += this.panHelper_Panning;
base.SizeChanged += new SizeChangedEventHandler(this.Map_SizeChanged);
BuildMapAction();//在MapActionPart.cs中
//添加缩放效果
if (ZoomEffectEnabled)
{
zoomEffectContainer = new Canvas();
zoomEffect = new ZoomEffect();
zoomEffectContainer.Children.Add(zoomEffect);
rootElement.Children.Add(zoomEffectContainer);
}
ScreenContainer = new Canvas();
rootElement.Children.Add(ScreenContainer);
this.rootElement.Children.Add(this.Popup);
if ((this.Layers != null) && (this.Layers.Count > 0))
{
if (!this.Layers.HasPendingLayers)
{
this.Layers_LayersInitialized(this.Layers, null);
}
else
{
foreach (Layer layer in this.Layers)
{
if (!layer.IsInitialized)
{
layer.Initialize();
}
}
}
}
}
}
/// <summary>${WP_mapping_Map_attribute_ScreenContainer_D}</summary>