lightswitch binding custom control

Listing 1: Setting up data binding for the Rating control

usingSystem.Windows.Controls;
usingSystem.Windows.Data;
usingMicrosoft.LightSwitch.Threading;
namespace LightSwitchApplication
{
    public partial class ShippersListDetail{
      partial void ShippersListDetail_Created() {
          var proxy =this.FindControl("ShipperRating");     proxy.ControlAvailable+=OnControlAvailable;
      }
      private void OnControlAvailable(object sender,ControlAvailableEventArgs e){
        Dispatchers.Main.BeginInvoke(()=>{
          Rating rc = e.ControlasRating; rc.ItemCount=5; rc.SelectionMode=RatingSelectionMode.Continuous;var b =newBinding("Value"); b.Mode=BindingMode.TwoWay; rc.SetBinding(Rating.ValueProperty, b);
        });
      }
    }
}

  lightswitch binding custom control_第1张图片

你可能感兴趣的:(lightswitch binding custom control)