
October 11, 2010 05:56 by
Brian Keating |
There are a few options when restricting what properties of a type get automatically bound by the framework.
Take the Loler type seen in my other MVC2 blog posts.
[Bind(Include="ID,Name,Description")]
public class Loler
{
//entity framework generated
}
Notice only the ID Name and Description properties will be bound by MVC Framework.
Per Usage restriction
UpdateModel(loler, new[] { "ID", "Name", "Description" });
Action method restrictions
[HttpPost]
ActionResult Create([Bind(Include="ID,Name,Description")] Loler loler)
{
// implementation
}
d36efbdf-90e8-4b4c-809d-7713317a5488|0|.0

May 12, 2010 19:44 by
Brian Keating |
If you're interested to see how to attach commands to listview items for use with an implementation of the MVVM pattern, have a look at this.
<Style x:Key="Local_OpenEntityStyle"
TargetType="{x:Type ListViewItem}">
<Setter Property="acb:CommandBehavior.Event"
Value="MouseDoubleClick" />
<Setter Property="acb:CommandBehavior.Command"
Value="{Binding ElementName=uiEntityListDisplay, Path=DataContext.OpenEntityCommand}" />
<Setter Property="acb:CommandBehavior.CommandParameter"
Value="{Binding}" />
</Style>
Here the command to be fired on the MouseDoubleClick event is set, the CommandParameter, will be the data object that we click on.
59f0a853-441b-4095-bf1d-6ceba053a1ad|2|1.0