This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class County | |
{ | |
public string GeographyWKT | |
{ | |
get | |
{ | |
return this.Geography.STAsText().ToSqlString().Value; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MapViewModel : INotifyPropertyChanged | |
{ | |
private SilverlightSqlSpatial.Service.DataManager dataContext; | |
private DataServiceQuery<County> query; | |
private ObservableCollection<County> spatialData; | |
public MapViewModel() | |
{ | |
dataContext = new SilverlightSqlSpatial.Service.DataManager(new Uri("http://localhost:YOURPORT/SampleServiceName.svc/")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MainPage : UserControl | |
{ | |
public MainPage() | |
{ | |
InitializeComponent(); | |
this.DataContext = new ViewModels.MapViewModel(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid.Resources> | |
<!--Add the extended data converter so we can read the extended data in the tooltip--> | |
<telerik:ExtendedDataConverter x:Key="ExtendedDataConverter" /> | |
<!--Create a template for the county tooltips, using the ExtendedDataConverter--> | |
<DataTemplate x:Key="CountyToolTipDataTemplate"> | |
<StackPanel Margin="10,5"> | |
<TextBlock FontWeight="Bold" Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='Name'}" /> | |
<TextBlock Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='StateName'}" /> | |
</StackPanel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid.Resources> | |
<!--Add the extended data converter so we can read the extended data in the tooltip--> | |
<telerik:ExtendedDataConverter x:Key="ExtendedDataConverter" /> | |
<!--Create a template for the county tooltips, using the ExtendedDataConverter--> | |
<DataTemplate x:Key="CountyToolTipDataTemplate"> | |
<StackPanel Margin="10,5"> | |
<TextBlock FontWeight="Bold" Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='Name'}" /> | |
<TextBlock Text="{Binding Converter={StaticResource ExtendedDataConverter}, ConverterParameter='StateName'}" /> | |
</StackPanel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Add the rad map--> | |
<telerik:RadMap x:Name="RadMap1" | |
Center="38.0, -98.371616833534" | |
ZoomLevel="4"> | |
<!--Set the map provider--> | |
<telerik:RadMap.Providers> | |
<telerik:OpenStreetMapProvider /> | |
</telerik:RadMap.Providers> | |
<!--Create an information layer to display our shapes--> | |
<telerik:InformationLayer x:Name="InformationLayer"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override bool CreateLiteralSql(ref Data.DataHolder holder) | |
{ | |
//If there is no value, then we want to query against null. | |
if (holder.NoValue) | |
{ | |
holder.StringValue = "NULL"; | |
//returning false indicates that no quotes are required. We want NULL instead of 'NULL' | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override Data.AdoTypeConverter Initialize(Data.IDataColumn user, Type clr, Data.IAdoTypeConverterRegistry registry, bool secondaryTable) | |
{ | |
//first we need to ensure that the clr type can be handled by this converter | |
if (clr == typeof(int) && user.ResolvedSqlType == "varchar") | |
{ | |
//then we need to set a flag to determine if the type is nullable | |
nullable = typeof(int?) == clr; | |
//finally return base.Initialize, which ultimatly returns "this" | |
return base.Initialize(user, clr, registry, secondaryTable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override Type DefaultType | |
{ | |
get { return typeof(int); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Varchar2IntConverter : Telerik.OpenAccess.Data.AdoTypeConverter | |
{ | |
//create flag to mark whether the CLR type is nullable or not | |
private bool nullable; | |
} |
OlderNewer