0
我已經在我的GISPointSelecter控件上以通常的方式設置了一個依賴項屬性。依賴屬性不會設置
public static readonly DependencyProperty GISMapProperty = DependencyProperty.Register(nameof(GISMap), typeof(GISControl), typeof(GISPointSelecter), new PropertyMetadata(null));
public GISControl GISMap
{
get
{
return (GISControl)GetValue(GISMapProperty);
}
set
{
SetValue(GISMapProperty, value);
}
}
但是,當我去加載此XAML ...
<Grid xmlns="http://schemas.microsoft.com/client/2007" xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:xivic="clr-namespace:Adapt.Presentation.Xivic;assembly=Adapt.Presentation.Xivic" xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:xiviccontrols="clr-namespace:Adapt.Presentation.XivicControls;assembly=Adapt.Presentation.XivicControls" xmlns:fw="clr-namespace:System.Windows.Controls;assembly=FloatableWindow" xmlns:adaptcontrols="clr-namespace:Adapt.Presentation.Controls;assembly=Adapt.Presentation.Controls" xmlns:PivotSDK="clr-namespace:System.Windows.Controls.Pivot;assembly=System.Windows.Controls.Pivot" xmlns:query="clr-namespace:Adapt.Model.Data;assembly=Adapt.Model.Common.Silverlight" xmlns:data="clr-namespace:Adapt.Presentation.Data;assembly=Adapt.Presentation.XivicControls" xmlns:adaptdata="clr-namespace:Adapt.Model.Data;assembly=Adapt.Model.Common.Silverlight" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<xiviccontrols:GISPointSelecter Name="GISMapControl" MiniMenuTrackButtons="Visible">
<xiviccontrols:GISPointSelecter.GISMap>
<xiviccontrols:GISControl x:Name="GISMap1" AutoMarkingEnabled="True" EsriOfflineZoomOutDisplay="300" DontRenderFullExtent="False" >
<xiviccontrols:GISControl.LocationTypes>
<sys:String>ShapeKey</sys:String>
</xiviccontrols:GISControl.LocationTypes>
<xiviccontrols:GISControl.LocationReferences>
<sys:String>Asset.GISKey</sys:String>
</xiviccontrols:GISControl.LocationReferences>
<xiviccontrols:GISControl.OverlayReferences>
<sys:String>, TaskDetail_, , Open Task, New Task</sys:String>
</xiviccontrols:GISControl.OverlayReferences>
<xiviccontrols:GISControl.MarkerConditionEquations>
<sys:String>OverallResultTag = Red</sys:String>
<sys:String>OverallResultTag = Yellow</sys:String>
<sys:String>OverallResultTag = Orange</sys:String>
<sys:String>OverallResultTag = Blue</sys:String>
<sys:String>OverallResultTag = No</sys:String>
<sys:String>OverallResultTag = </sys:String>
</xiviccontrols:GISControl.MarkerConditionEquations>
<xiviccontrols:GISControl.MarkerConditionColours>
<sys:String>Red</sys:String>
<sys:String>Yellow</sys:String>
<sys:String>Orange</sys:String>
<sys:String>Blue</sys:String>
<sys:String>Green</sys:String>
<sys:String>White</sys:String>
</xiviccontrols:GISControl.MarkerConditionColours>
<xiviccontrols:GISControl.AutoMarkLayers>
<xiviccontrols:AutoMarkLayer AssetForeignKey="Asset" LayerKey="f38d3a14-9fec-495c-b524-c96bec5443f7" MinExtentLongitude="4000" MarkerDataType="Adapt.Model.TaskManagement.TaskInfo">
<xiviccontrols:AutoMarkLayer.MarkerDataQuery>
<adaptdata:DataQuery FromTableAlias="Tasks">
<adaptdata:DataQuery.WhereClauses>
<adaptdata:WhereClauseJoiner>OpenBracket</adaptdata:WhereClauseJoiner>
<adaptdata:WhereClause LeftExpression="Tasks.Activity" WhereClauseType="Equals" RightExpression="1" />
<adaptdata:WhereClauseJoiner>Or</adaptdata:WhereClauseJoiner>
<adaptdata:WhereClause LeftExpression="Tasks.Activity" WhereClauseType="Equals" RightExpression="5" />
<adaptdata:WhereClauseJoiner>Or</adaptdata:WhereClauseJoiner>
<adaptdata:WhereClause LeftExpression="Tasks.Activity" WhereClauseType="Equals" RightExpression="6" />
<adaptdata:WhereClauseJoiner>Or</adaptdata:WhereClauseJoiner>
<adaptdata:WhereClause LeftExpression="Tasks.Activity" WhereClauseType="Equals" RightExpression="7" />
<adaptdata:WhereClauseJoiner>CloseBracket</adaptdata:WhereClauseJoiner>
<adaptdata:WhereClauseJoiner>And</adaptdata:WhereClauseJoiner>
<adaptdata:WhereClause LeftExpression="Tasks.StatusKey" WhereClauseType="Equals" RightExpression="2" />
</adaptdata:DataQuery.WhereClauses>
</adaptdata:DataQuery>
</xiviccontrols:AutoMarkLayer.MarkerDataQuery>
</xiviccontrols:AutoMarkLayer>
</xiviccontrols:GISControl.AutoMarkLayers>
</xiviccontrols:GISControl>
</xiviccontrols:GISPointSelecter.GISMap>
</xiviccontrols:GISPointSelecter>
...的屬性未設置,默認爲空,然後我在得到一個NullReferenceException GISPointSelecter構造函數。
public GISPointSelecter()
{
InitializeComponent();
GISMap.LeftIndent = 145;
LayoutRoot.Children.Insert(0, GISMap);
GISMap.Click += new GISControl.GISControlClickedDelegate(Map_Click);
GISMap.GISRequestedCloseSplash += new EventHandler<EventArgs>(GISMap_GISRequestedCloseSplash);
ViewAssetsMiniMenu.XamlProviderLoaded += new EventHandler<EventArgs>(ViewAssetsMiniMenu_XamlProviderLoaded);
}
我在做什麼錯?