我有以下xaml代码:
//some code
<ListBox>
<StackPanel Name="Mess">
</StackPanel>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
然后我添加元素StackPanel.
但在某个特定的时刻,我需要删除所有的儿童元素Mess.我该怎么做?
我开发windows-phone应用程序,我想创建2行2列的表我为这个表创建xaml代码
<Grid Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
我想在代码中创建这个Grid
Grid chat_userpicgrid = new Grid();
newgrid.Children.Add(chat_userpicgrid);
Run Code Online (Sandbox Code Playgroud)
但我不知道如何创建RowDefinitions和ColumnDefinitions.
我是Silverlight的新手。我正在Windows Phone的Visual Studio 2010中编程。我尝试执行HttpWebRequest,但调试器说ProtocolViolationException。这是我的代码
private void log_Click(object sender, RoutedEventArgs e)
{
//auth thi is my url for request
string auth;
string login = Uri.EscapeUriString(this.login.Text);
string password = Uri.EscapeUriString(this.pass.Password);
auth = "https://api.vk.com/oauth/token";
auth += "?grant_type=password" + "&client_id=*****&client_secret=******&username=" + login + "&password=" + password + "&scope=notify,friends,messages";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(auth);
request.BeginGetRequestStream(RequestCallBack, request);//on this line debager say ProtocolViolationExceptio
}
void RequestCallBack(IAsyncResult result)
{
HttpWebRequest request = result.AsyncState as HttpWebRequest;
Stream stream = request.EndGetRequestStream(result);
request.BeginGetResponse(ResponceCallBack, request);
}
void ResponceCallBack(IAsyncResult result)
{
HttpWebRequest request = …Run Code Online (Sandbox Code Playgroud)