or
List<Telerik.Windows.Controls.Map.Location> locations =
this
.MyPushpins.Select(pin => pin.Location).ToList();
LocationRect rect = this.GetBestView(locations,
new
Size(0.01, 0.01));
MapCenter = rect.Center;
MapZoomLevel = rect.ZoomLevel;
public
LocationRect GetBestView(IEnumerable<PointOfInterest> itemsList, Size defaultSize)
{
LocationRect bestView =
new
LocationRect();
Location northEast = Location.Empty;
Location southWest = Location.Empty;
foreach
(PointOfInterest item
in
itemsList)
{
Location location = item.Location;
if
(northEast.IsEmpty)
{
northEast = location;
}
else
{
if
(!location.IsEmpty)
{
northEast.Latitude = Math.Max(northEast.Latitude, location.Latitude);
northEast.Longitude = Math.Max(northEast.Longitude, location.Longitude);
}
}
if
(southWest.IsEmpty)
{
southWest = location;
}
else
{
if
(!location.IsEmpty)
{
southWest.Latitude = Math.Min(southWest.Latitude, location.Latitude);
southWest.Longitude = Math.Min(southWest.Longitude, location.Longitude);
}
}
}
if
(!northEast.IsEmpty && !southWest.IsEmpty)
{
bestView =
new
LocationRect(northEast, southWest);
if
(bestView.IsEmpty)
{
bestView =
new
LocationRect(
new
Location(bestView.North + defaultSize.Height / 2.0, bestView.West - defaultSize.Width / 2.0),
new
Location(bestView.North - defaultSize.Height / 2.0, bestView.West + defaultSize.Width / 2.0));
}
}
return
bestView;
}
public
class
ViewModel
{
public
List<Location> Locations {
get
{
return
new
List<Location>() {
new
Location(0, 0)}; } }
}
<
Window
x:Class
=
"TelerikMapTest.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:TelerikMapTest
=
"clr-namespace:TelerikMapTest"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.DataContext
>
<
TelerikMapTest:ViewModel
/>
</
Window.DataContext
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"template"
>
<
telerik:MapEllipse
Width
=
"1000"
Height
=
"1000"
Fill
=
"Blue"
Opacity
=
"0.6"
telerik:MapLayer.Location
=
"{Binding}"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
XUnits
=
"Fraction"
YUnits
=
"Fraction"
/>
</
telerik:MapLayer.HotSpot
>
</
telerik:MapEllipse
>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
>
<
telerik:RadMap
>
<
telerik:RadMap.Provider
>
<
telerik:OpenStreetMapProvider
/>
</
telerik:RadMap.Provider
>
<
telerik:InformationLayer
ItemsSource
=
"{Binding Locations}"
ItemTemplate
=
"{StaticResource template}"
/>
<
telerik:InformationLayer
>
<
telerik:MapEllipse
Width
=
"1000"
Height
=
"1000"
Fill
=
"Yellow"
Opacity
=
"0.6"
telerik:MapLayer.Location
=
"0,0"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
XUnits
=
"Fraction"
YUnits
=
"Fraction"
/>
</
telerik:MapLayer.HotSpot
>
</
telerik:MapEllipse
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
</
Grid
>
</
Window
>
<tcg:GridViewDataColumn DataMemberBinding=
"{Binding ITEM.Deliverydate}"
DataFormatString=
"{}{0:dd/MM/yyyy}"
Header=
"Delivery Date"
>
public
partial
class
PlaybackView : UserControl, INotifyPropertyChanged
{
int
_count = 0;
public
PlaybackView()
{
InitializeComponent();
}
#region Properties
public
DataTable PlaybackTable
{
get
{
return
(DataTable)GetValue(PlaybackTableProperty); }
set
{
SetValue(PlaybackTableProperty, value);
}
}
// Using a DependencyProperty as the backing store for DataTable. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty PlaybackTableProperty = DependencyProperty.Register(
"PlaybackTable"
,
typeof
(DataTable),
typeof
(PlaybackView));
//private static void OnPresentableTableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
//{
// PlaybackView playbackView = d as PlaybackView;
// if (playbackView != null)
// {
// playbackView.PlaybackLogView = new ListCollectionView(playbackView.PlaybackTable.DefaultView);
// }
//}
public
List<
string
> GroupBy
{
get
{
return
(List<
string
>)GetValue(GroupByTextProperty); }
set
{
SetValue(GroupByTextProperty, value);
}
}
public
static
readonly
DependencyProperty GroupByTextProperty = DependencyProperty.Register(
"GroupBy"
,
typeof
(List<
string
>),
typeof
(PlaybackView),
new
UIPropertyMetadata(
null
, OnGroupByPropertyChanged));
private
static
void
OnGroupByPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//PlaybackView playbackView = d as PlaybackView;
//if (playbackView != null)
//{
// playbackView.PlaybackLogView.GroupDescriptions.Add(new PropertyGroupDescription(playbackView.GroupBy));
//}
}
#endregion
#region INotifyPropertyChanged Members
public
event
PropertyChangedEventHandler PropertyChanged;
protected
void
OnPropertyChanged(
string
name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if
(handler !=
null
)
{
handler(
this
,
new
PropertyChangedEventArgs(name));
}
}
#endregion
private
void
telrikDataGrid_DataLoading(
object
sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
{
if
(GroupBy.Count > 0)
{
if
(_count > 0)
{
this
.telrikDataGrid.GroupDescriptors.Clear();
}
ColumnGroupDescriptor descriptor =
new
ColumnGroupDescriptor();
descriptor.Column =
this
.telrikDataGrid.Columns[GroupBy[0]];
this
.telrikDataGrid.GroupDescriptors.Add(descriptor);
++_count;
}
}
}
-------------------------------------------XAMl Code----------------------------------------------
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=
"Auto"
/>
<RowDefinition Height=
"Auto"
/>
<RowDefinition Height=
"*"
/>
</Grid.RowDefinitions>
<Button Content=
"Load Data"
HorizontalAlignment=
"Right"
Click=
"Button_Click"
/>
<CheckBox x:Name=
"_check"
Grid.Row=
"1"
Content=
"Visibility"
IsChecked=
"True"
/>
<telerik:RadGridView Grid.Row=
"2"
x:Name=
"_telerikGrid"
ShowColumnFooters=
"True"
AutoGenerateColumns=
"False"
ItemsSource=
"{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Table}"
>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header=
"PresentationName"
DataMemberBinding=
"{Binding PresentationName}"
>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header=
"LogLevel"
DataMemberBinding=
"{Binding LogLevel}"
IsVisible=
"{Binding ElementName=_check, Path=IsChecked}"
>
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:CountFunction Caption=
"Total Rows"
/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
public
partial
class
PlaybackView : UserControl, INotifyPropertyChanged
{
int
_count = 0;
public
PlaybackView()
{
InitializeComponent();
}
#region Properties
public
DataTable PlaybackTable
{
get
{
return
(DataTable)GetValue(PlaybackTableProperty); }
set
{
SetValue(PlaybackTableProperty, value);
}
}
// Using a DependencyProperty as the backing store for DataTable. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty PlaybackTableProperty = DependencyProperty.Register(
"PlaybackTable"
,
typeof
(DataTable),
typeof
(PlaybackView));
//private static void OnPresentableTableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
//{
// PlaybackView playbackView = d as PlaybackView;
// if (playbackView != null)
// {
// playbackView.PlaybackLogView = new ListCollectionView(playbackView.PlaybackTable.DefaultView);
// }
//}
public
List<
string
> GroupBy
{
get
{
return
(List<
string
>)GetValue(GroupByTextProperty); }
set
{
SetValue(GroupByTextProperty, value);
}
}
public
static
readonly
DependencyProperty GroupByTextProperty = DependencyProperty.Register(
"GroupBy"
,
typeof
(List<
string
>),
typeof
(PlaybackView),
new
UIPropertyMetadata(
null
, OnGroupByPropertyChanged));
private
static
void
OnGroupByPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//PlaybackView playbackView = d as PlaybackView;
//if (playbackView != null)
//{
// playbackView.PlaybackLogView.GroupDescriptions.Add(new PropertyGroupDescription(playbackView.GroupBy));
//}
}
#endregion
#region INotifyPropertyChanged Members
public
event
PropertyChangedEventHandler PropertyChanged;
protected
void
OnPropertyChanged(
string
name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if
(handler !=
null
)
{
handler(
this
,
new
PropertyChangedEventArgs(name));
}
}
#endregion
private
void
telrikDataGrid_DataLoading(
object
sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
{
if
(GroupBy.Count > 0)
{
if
(_count > 0)
{
this
.telrikDataGrid.GroupDescriptors.Clear();
}
ColumnGroupDescriptor descriptor =
new
ColumnGroupDescriptor();
descriptor.Column =
this
.telrikDataGrid.Columns[GroupBy[0]];
this
.telrikDataGrid.GroupDescriptors.Add(descriptor);
++_count;
}
}
}
-------------------------------------------XAMl Code----------------------------------------------
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=
"Auto"
/>
<RowDefinition Height=
"Auto"
/>
<RowDefinition Height=
"*"
/>
</Grid.RowDefinitions>
<Button Content=
"Load Data"
HorizontalAlignment=
"Right"
Click=
"Button_Click"
/>
<CheckBox x:Name=
"_check"
Grid.Row=
"1"
Content=
"Visibility"
IsChecked=
"True"
/>
<telerik:RadGridView Grid.Row=
"2"
x:Name=
"_telerikGrid"
ShowColumnFooters=
"True"
AutoGenerateColumns=
"False"
ItemsSource=
"{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Table}"
>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header=
"PresentationName"
DataMemberBinding=
"{Binding PresentationName}"
>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header=
"LogLevel"
DataMemberBinding=
"{Binding LogLevel}"
IsVisible=
"{Binding ElementName=_check, Path=IsChecked}"
>
<telerik:GridViewDataColumn.AggregateFunctions>
<telerik:CountFunction Caption=
"Total Rows"
/>
</telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
<
telerik:RadDateTimePicker
SelectedValue
=
"{Binding TheVisitDateTime, Mode=TwoWay}"
/>
@dVisitDateTime
is SMALLDATETIME data type).exec
schma.CompleteClientVisit @iVisitID = 1, @dVisitDateTime =
'2011-11-22 15:47:10.25039'
, ...other params...
Msg 8114,
Level
16, State 1,
Procedure
CompleteClientVisit, Line 0
Error converting data type
varchar
to
smalldatetime.
exec
schma.CompleteClientVisit @iVisitID = 1, @dVisitDateTime =
'2011-11-22 15:47:00'
, ...other params...
<Horaire:DayViewDefinition DayStartTime="06:00"
DayEndTime="23:00"
MajorTickLength="1h"
MinorTickLength="5min"
TimerulerMinorTickStringFormat=":{0:mm} "
TimerulerMajorTickStringFormat="{}{0:HH}:{0:mm} "
MinTimeRulerExtent="4000"/>
Thanks for you help.