1
我有一個風格圖釘綁定圖釘風格文本PushPin.Text
<Style x:Key="PushPinStyle" TargetType="Maps:Pushpin">
<Setter Property="Width" Value="25"/>
<Setter Property="Height" Value="39"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Image Source="Assets/Point.png" Stretch="Uniform" HorizontalAlignment="Left"/>
<TextBlock Text={Binding Text}/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
而且我想文本塊綁定到pushpin.text
public void AddPushpin(Location latlong, string title, string description, MapLayer layer,string pinText)
{
try
{
Pushpin p = new Pushpin()
{
Tag = new Metadata()
{
Title = title,
Description = description
}
};
//
p.Style = this.Resources["PushPinStyle"] as Style;
p.Text = pinText; //This should appear in pushpin on top of Image
MapLayer.SetPosition(p, latlong);
p.Tapped += PinTapped;
layer.Children.Add(p);
}
catch (Exception ex)
{
}
}
但所有我只能看到是形象。
如何將PushPin.text綁定到樣式的TextBlock並將其顯示在樣式的圖像上方?
文本不{TemplateBinding文字}辨認,沒有工作 – uncia
退房更新的解決方案。 – Xyroid