1
SharePoint Webパーツプロジェクトで定義された2つのパラメータは、ユーザーが2つのコンボボックスから選択するとSilverlightアプリケーションのApplication_Startup()プロパティ)。何とかSilverlightコントロールは、SharePointサイトにロードするとレンダリングされません。 1つのパラメータが渡されると、コントロールはエラーなしで表示されます。何か案は?構文?例?SharePoint WebパーツプロジェクトからSilverlightコントロールへの2つのパラメータをSilverlightアプリケーションに渡します。
App.xaml.cs:
private void Application_Startup(object sender, StartupEventArgs e)
{
//testing
string _setArticles = null;
string _setLength = null;
if (e.InitParams != null && e.InitParams.Count >= 1)
{
_setArticles = e.InitParams["_setArticles"];
_setLength = e.InitParams["_setLength"];
}
this.RootVisual = new Page(_setArticles, _setLength);
}
Page.xaml.cs:
public Page(string _setArticles, string _setLength)
{
InitializeComponent();
//(number of items to display on load)
if (!string.IsNullOrEmpty(_setArticles) && !string.IsNullOrEmpty(_setLength))
{
if (_setArticles.Equals("_1_article"))
retrieveOneListboxItemStaffNews();
GetData3();
if (_setArticles.Equals("_2_articles"))
retrieveTwoListboxItemStaffNews();
GetData3();
if (_setArticles.Equals("_3_articles"))
retrieveThreeListboxItemStaffNews();
GetData3();
//testing
//send value to method 'fullNameControl_Loaded' (summary length of each ListBox item)
if (_setLength.Equals("_3_lines"))
m_textBlock.MaxHeight = 40;
if (_setLength.Equals("_4_lines"))
m_textBlock.MaxHeight = 50;
if (_setLength.Equals("_5_lines"))
m_textBlock.MaxHeight = 65;
}
}
SilverlightSecondWebPart.cs:
protected override void CreateChildControls()
{
base.CreateChildControls();
//silverlight control
silverlightControl = new Silverlight();
silverlightControl.ID = "News";
silverlightControl.Source = "/ClientBin/News.xap";
silverlightControl.Width = new System.Web.UI.WebControls.Unit(800);
silverlightControl.Height = new System.Web.UI.WebControls.Unit(550);
//testing
string parameters = "_setArticles=" + _myEnum + ", " + "_setLength=" + _myEnum2;
silverlightControl.InitParameters = parameters;
silverlightControl.MinimumVersion = "2.0";
Controls.Add(silverlightControl);
}
応答に感謝します。あなたは、どうやってデータ型の中に埋め込まれたテキストブロックにアクセスするのか知っていますか?オンラインの例は、x:key @ gridを指定することに関係するので、あまり役に立ちませんか? – brainsfrying