Data binding 将灯光开关属性加载到Silverlight控件

Data binding 将灯光开关属性加载到Silverlight控件,data-binding,controls,silverlight-5.0,lightswitch-2012,Data Binding,Controls,Silverlight 5.0,Lightswitch 2012,但当我运行此程序时,对象结果为null,因为在加载lightswitch屏幕之前调用了预定义的Loaded silverlight函数,当我调用按钮上的方法get属性时,单击结果不是null,因为加载了lightswitch屏幕。所以,我的问题是,在屏幕以某种昂贵的方式加载后,如何调用此方法,无需单击按钮。好的,我这样解决了它 I have control like this <UserControl x:Class="VideoControl.VideoControl" Loaded

但当我运行此程序时,对象结果为null,因为在加载lightswitch屏幕之前调用了预定义的Loaded silverlight函数,当我调用按钮上的方法get属性时,单击结果不是null,因为加载了lightswitch屏幕。所以,我的问题是,在屏幕以某种昂贵的方式加载后,如何调用此方法,无需单击按钮。

好的,我这样解决了它

 I have control like this

<UserControl x:Class="VideoControl.VideoControl" Loaded="getProperty"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
</UserControl>
private void getProperty(object sender, RoutedEventArgs e) {
  var objContext = (IContentItem)this.DataContext;
  var Scrn = (Microsoft.LightSwitch.Client.IScreenObject)objContext.Screen;
  var anonObject = Scrn.Details.Properties["VidContentItemRessourcesItem"].Value;

    string result= anonObject.GetType().GetProperty("AssetPubLocator").GetValue(anonObject, null).ToString();

}
 // My control property
public MyControlType MyControl;

    partial void MyEntity_Loaded(bool succeeded) {

      this.SetDisplayNameFromEntity(this.MyEntity);
      // Open in new Thread
      Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(() => {
        this.FindControl("VideoControler").ControlAvailable += (s, e) => {
          // Loading Control
          MyControl = (e.Control as MyControlNamespace.MyControlType);
        };

        // Calling method in Control and sending property there :-)
        MyControl.PropertiesLoaded(this.MyEntity.SomeString);
      });
    }