When working with Caliburn.Micro you can use DataContextProxy to define DataContext from the Map so you can bind to it since Caliburn handles ViewModel mapping automatically.DataContext can be proxied with solution like this: public class DataContextProxy : Freezable { #region Overrides of Freezable protected override Freezable CreateInstanceCore() { return new DataContextProxy(); } #endregion public object Data { get { return (object)GetValue(DataProperty); } set { SetValue(DataProperty, value); } } public static readonly DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(object), typeof(DataContextProxy), new UIPropertyMetadata(null)); }
And in the XAML you can use it like this <esri:Map> <esri:Map.Resources> <local:DataContextProxy x:Key="proxy" Data="{Binding}" /> </esri:Map.Resources> <esri:ArcGISTiledMapServiceLayer ID="PhysicalTiledLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <esri:GraphicsLayer ID="MyGraphicsLayer" GraphicsSource="{Binding Path=Data.SearchResults, Source={StaticResource proxy}}" Renderer="{StaticResource MySimpleRenderer}" /> </esri:Map>
This is just one solution but seems to work quite well in the cases where you don't set ViewModels explicitly in the XAML.Edit: Note that when using proxy like this, you need to prefix binding to real proxy property since the solution is kind of relative binding. In this case, path is set to Data.SearchResults.