本文整理汇总了C#中MainViewModel.ListenToProperty方法的典型用法代码示例。如果您正苦于以下问题:C# MainViewModel.ListenToProperty方法的具体用法?C# MainViewModel.ListenToProperty怎么用?C# MainViewModel.ListenToProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainViewModel
的用法示例。
在下文中一共展示了MainViewModel.ListenToProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attach
public void Attach( DependencyObject associatedObject )
{
if ( DesignMode.DesignModeEnabled )
{
return;
}
AssociatedObject = associatedObject;
_map = (MapControl) associatedObject;
_labelsOverlay = new Image();
_labelsOverlay.ImageOpened += ( _, __ ) =>
{
Geopoint topLeft;
_map.GetLocationFromOffset( new Point( 0, 0 ), out topLeft );
MapControl.SetLocation( _labelsOverlay, topLeft );
_labelsOverlay.Visibility = Visibility.Visible;
};
_map.Children.Add( _labelsOverlay );
_map.Loaded += ( _, __ ) =>
{
_vm = (MainViewModel) _map.DataContext;
OnFloorChanged( _vm.Properties.Floor );
OnItemsChanged( _vm.SearchResults );
_properties = _vm.Properties;
_vm.Properties.ListenToProperty( x => x.Center, UpdateLabelsOverlay );
_vm.Properties.ListenToProperty( x => x.Floor, UpdateLabelsOverlay );
_vm.Properties.ListenToProperty( x => x.ZoomLevel, UpdateLabelsOverlay );
UpdateLabelsOverlay();
_vm.Properties.ListenToProperty( x => x.Floor, () => OnFloorChanged( _vm.Properties.Floor ) );
_vm.ListenToProperty( x => x.SearchResults, () => OnItemsChanged( _vm.SearchResults ) );
var buildingsDataSource = EpflTileSources.GetForBuildings( _vm.Properties );
_map.TileSources.Add( new MapTileSource( buildingsDataSource ) );
};
// HACK: Force the map to always face North, so that buildings labels are shown properly.
_map.HeadingChanged += ( _, __ ) => _map.Heading = 0;
}