小编use*_*524的帖子

从StackPanel中删除所有子元素

我有以下xaml代码:

//some code
<ListBox>
<StackPanel Name="Mess">
</StackPanel>
</ListBox>
Run Code Online (Sandbox Code Playgroud)

然后我添加元素StackPanel.

但在某个特定的时刻,我需要删除所有的儿童元素Mess.我该怎么做?

c# windows-phone

10
推荐指数
1
解决办法
2万
查看次数

在代码中创建RowDefinitions和ColumnDefinitions

我开发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.

xaml windows-phone

3
推荐指数
1
解决办法
2118
查看次数

为什么我执行BeginGetRequestStream时会收到ProtocolViolationException

我是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)

c# silverlight windows-phone

2
推荐指数
1
解决办法
5700
查看次数

标签 统计

windows-phone ×3

c# ×2

silverlight ×1

xaml ×1