1
두 개의 매개 변수가 SharePoint 웹 파트 프로젝트에 정의되어 있고 사용자가 2 개의 콤보 상자 (탐색 가능)에서 선택할 때 Silverlight 응용 프로그램의 Application_Startup() 속성). 어떻게 든 Silverlight 컨트롤은 SharePoint 사이트에로드 할 때 렌더링되지 않습니다. 1 매개 변수가 전달되면 컨트롤은 오류없이 표시됩니다. 어떤 아이디어? 통사론? 예?SharePoint 웹 파트 프로젝트에서 Silverlight 컨트롤로 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);
}
응답 해 주셔서 감사합니다. 당신은 어떻게 datatemplate 내에 포함 된 textblock에 접근 할 수 있는지 알고 있습니까? 온라인 예제는 x : 키 @ 그리드를 지정하는 것과 관련되어 있으므로 도움이되지 않습니까? – brainsfrying