【发布时间】:2013-01-06 01:09:21
【问题描述】:
基本上,我的问题已经出现在标题中: 当我有如下 MainWindow 时:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:easycache"
xmlns:map="clr-namespace:MapControl;assembly=MapControl.WPF"
x:Class="easycache.MainWindow"
x:Name="MainWindow1"
Title="easycache"
Height="600"
Width="850">
<map:Map Grid.Column="2"
Grid.Row="1"
Name="map"
IsManipulationEnabled="True"
LightForeground="Black"
LightBackground="White"
DarkForeground="White"
DarkBackground="#FF3F3F3F"
Center="0.0,0.0"
ZoomLevel="0.0"
TileLayer="{Binding Source={StaticResource TileLayersView}, Path=CurrentItem}" />
在我的窗口 2 中,我有:
<map:Map Name="map" IsManipulationEnabled="False"
LightForeground="Black" LightBackground="White" DarkForeground="White" DarkBackground="#FF3F3F3F"
Center="0.0,0.0" ZoomLevel="{Binding ?????}">
我想将 Window2 中地图的 ZoomLevel 绑定到我的 MainWindow 中地图的 ZoomLevel。我怎样才能做到这一点?
问候, 亚洛金
【问题讨论】:
-
如果你在做 MVVM,那么应该通信的是 ViewModel。如果你不是更简单。告诉我哪个,以便我可以给出正确的答案,问候
-
我同意 Hannish 的观点 - 有几种不同的方法可以做到这一点,具体取决于您的程序的架构方式。你在任何地方都使用 MVVM、ViewModels 和 Bindings 吗?还是只是直接事件和代码隐藏之类的?
-
感谢您的快速回答,我没有使用 MVVM!那你能给我举个例子吗?
-
怎么了? @Hannish,拜托,你能给我举个例子吗?我真的不知道该怎么办......