RaisePropertyChanged on a Link Label

It think I might have found a bug, but maybe there is a work around. If I bind to a link label Text in my model and update the text with a RaisePropertyChanged, it updates the label, but if the new text in the model is longer than the older text, it cuts it off at the old text length. If i then click on the label, it adjusts correctly.

-Mike

Are you targeting Silverlight?

You may need to call Link.Remeasure(). It would probably be best to do so in a custom PartManager, where you can override the PartManager.OnModelChanged method to check for your particular text property name. Something like:

public override void OnModelChanged(ModelChangedEventArgs e) { base.OnModelChanged(e); if (e.Change == ModelChange.Property && e.PropertyName == "LabelText") { MyLinkData data = e.Data as MyLinkData; if (data != null) { Link link = FindLinkForData(data, this.Diagram.Model); if (link != null) { link.Remeasure(); } } } }

thanks Walter,

I tried it and it works. Here was my final code in case anyone is interested.
using Northwoods.GoXam; using Northwoods.GoXam.Model; using MyProject.Model; namespace MyProject.View
{
public class CustomPartManager : PartManager
{
public override void OnModelChanged(ModelChangedEventArgs e)
{
base.OnModelChanged(e);
if (e.Change == ModelChange.Property && e.PropertyName == "Name"
&& e.Data.GetType() == typeof(LatLinkModel))
{
var data = e.Data as LatLinkModel;
if (data != null)
{
Link link = FindLinkForData(data, Diagram.Model);
if (link != null)
{
link.Remeasure();
}
}
}
} } }
And I added a initialization to the diagram in the constructor of my view in code behind (it didn't seem to work quite right when I did directly it in XAML, but I could have done something wrong)
// in the constructor of the view containg the GoXAM diagram control
myDiagram.PartManager = new CustomPartManager();