This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi,
I'm not sure if I've done things incorrectly, but I'm getting strange behavior when I try to create custom DataTemplates involving ComboBox's when I use the ReadOnlyComboEditor style. There was a very recent post that was similar, but I think that this is a different problem for two reasons:
|
|
|
This also seems to be a problem with the ComboEditor style. |
|
|
There are a couple of issues here: First, your business object needs to implement INotifyPropertyChanged (and to raise the PropertyChanged event for all bindable properties). This will address the problem where the "edit" area fails to update. Second, the ReadOnlyComboEditor style assumes that the ComboBox is displaying the edited value. The TextBlock binds directly to Value of the data context object. This will work for your Letters box, which is displaying the value associated with the property row, but not for your Numbers box, which is displaying an associated value. We will look at fixing this, but in the meantime, I suggest you take a copy of the ReadOnlyComboEditor style from the Alloy.xaml file (starting at line 590 in the current build), paste it into your own app, and modify the TextBlock Text binding to read: Text="{Binding SelectedItem, RelativeSource={RelativeSource TemplatedParent}}" Taking your own copy of this style is probably a wise move anyway, as this particular resource does not have a documented key, so the name might change between releases! You would I think need to apply a similar change to the ComboEditor style, though I haven't tested this. Let us know if you still see problems after applying these changes! |
|