小编and*_*ubi的帖子

如何从Windows Phone 8中的listpicker获取所选项目?

我在windows手机中使用此代码创建listpicker.

<StackPanel Height="148" Margin="0,100,0,0">
   <toolkit:ListPicker Grid.Row="0" FontFamily="Segoe WP Semibold" Height="176" x:Name="Additional_Time" ItemTemplate="{StaticResource PickerItemTemplate}" FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" FullModeHeader="Cities" SelectedIndex="0" CacheMode="BitmapCache" Header="Choose Exit Time" FontSize="30" SelectionChanged="Additional_Time_SelectionChanged"/>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)

并使用此网格资源

<Grid.Resources>
        <DataTemplate x:Name="PickerItemTemplate">
            <StackPanel Orientation="Horizontal">
                <Border Background="LightGreen" Width="34" Height="34">
                    <TextBlock Text="{Binding Country}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </Border>
                <TextBlock Text="{Binding Name}" Margin="12 0 0 0"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Name="PickerFullModeItemTemplate">
            <StackPanel Orientation="Horizontal" Margin="16 21 0 20">
                <TextBlock Text="{Binding Name}" Margin="16 0 0 0" FontSize="43" FontFamily="{StaticResource PhoneFontFamilyLight}"/>

                <TextBlock Text="{Binding Language}" Foreground="Green"/>
            </StackPanel>
        </DataTemplate>
    </Grid.Resources>
Run Code Online (Sandbox Code Playgroud)

下面的代码用于将项目插入到listpicker中

List<Cities> source = new …
Run Code Online (Sandbox Code Playgroud)

selectionchanged listpicker windows-phone-8

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

在Windows Phone 8中解析xml数据

我有一个xml字符串来自Web服务器,如下所示

    <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <doLoginResponse xmlns="http://login.mss.uks.com">
    <doLoginReturn>
      <errorCode>IPH_I_LGN_002</errorCode>
      <errorMsg>Logged in sucessfully</errorMsg>
      <number>13733479454157901</number>
    </doLoginReturn>
  </doLoginResponse>
</soapenv:Body>
Run Code Online (Sandbox Code Playgroud)

我想解析xml字符串,并希望打印errorCode,errorMsg,number.我怎么能这样做

提前致谢.

c# xml windows-phone-8

0
推荐指数
1
解决办法
6328
查看次数

ReverseGeocodeQuery中的异常

我正在使用ReverseGeocodeQuery检索许多位置的地址.问题是我得到了一个例外,结果如下:

来自HRESULT的异常:0x80041B57

看看MSDN中的ReverseGeocodeQuery类引用,我可以看到它列在可能的错误结果中,符号代码为EErrorIndexFailure.但是,它没有给我更多关于错误的信息,StackTrace也是null.

我的代码如下:

foreach (var ev in events)
{
    ReverseGeocodeQuery query = new ReverseGeocodeQuery();
    query.GeoCoordinate = ev.Location;
    query.QueryCompleted += (s, e)=>
    {
        if (e.Error != null)
            return;

        ev.city = e.Result[0].Information.Address.City;
    };
    query.QueryAsync();
}
Run Code Online (Sandbox Code Playgroud)

为什么我会收到此错误,我怎么能让这个工作?

c# reverse-geocoding windows-phone windows-phone-8

0
推荐指数
1
解决办法
585
查看次数

为什么String.IsNullOrWhiteSpace(vbNullChar)= False?

我正在使用第三方库从机器的变量中获取数据.数据返回一个字符串类型,所以在请求数据后,我正在验证它不是一个空字符串,如下所示:

Not String.IsNullOrWhiteSpace(data)
Run Code Online (Sandbox Code Playgroud)

但是,我的程序失败了,我意识到当机器中的变量为空时,上面的函数返回True.

通过调试,我注意到,在第三方库的函数返回vbNullChar时,变量是空的,String.IsNullOrWhiteSpace(vbNullChar)计算结果为False,当我希望它以评估TrueString.IsNullOrWhiteSpace(vbNullString)一样.

那么我唯一的选择是检查如下?

Not String.IsNullOrWhiteSpace(data) AndAlso data <> vbNullChar
Run Code Online (Sandbox Code Playgroud)

.net vb.net string .net-4.0 char

0
推荐指数
1
解决办法
108
查看次数

使用文本中的指数提取双数值

如何从具有更多字符的字符串中提取可能具有指数的多个double类型?

例如提取物56.8671311035e-06

"这是一个数字在56.8671311035e-06内的字符串,字符串在这里继续"

我想可以使用正则表达式完成,但我对它们的了解非常有限.

c# regex string-parsing

-1
推荐指数
1
解决办法
843
查看次数