1

I am working on an app which require DigitLoopingSelector. After adding DigitLoopingSelector and running the program I was getting the error "Error HRESULT E_FAIL has been returned from a call to a COM component." Why I was getting this error in WIndows Phone8? DigitLoopingSelector works like datepicker ranging from my own set of values when selected on it.

//xaml code
<phone:PhoneApplicationPage
    x:Class="Jogger.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     
    xmlns:my="clr-namespace:Controls.Primitives;assembly=Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

//code for DigitLoopingSelector


                <Grid x:Name="WidthPanel" Grid.Row="1" VerticalAlignment="Center" Height="258" Width="480"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.3*"/>
                        <ColumnDefinition Width="0.1*"/>
                        <ColumnDefinition Width="0.30*"/>
                        <ColumnDefinition Width="0.2*"/>
                    </Grid.ColumnDefinitions>

                    <my:DigitLoopingSelector 
                Grid.Column="0"
                Name="WidthMeterSelector" 
        ItemSize="108,108"
        ItemMargin="6,3" HorizontalAlignment="Right" Margin="0" Width="108" IsExpanded="True"
                MaxValue="15" MinValue="1" DefaultValue="3"  SelectedItem="{Binding WidthMeter}" >
                        <my:DigitLoopingSelector.ItemTemplate>
                            <DataTemplate>
                                <TextBlock 
                Text="{Binding BindsDirectlyToSource=True}" 
                FontSize="54" TextAlignment="Center" VerticalAlignment="Center"
                FontFamily="{StaticResource PhoneFontFamilySemiBold}"/>
                            </DataTemplate>
                        </my:DigitLoopingSelector.ItemTemplate>
                    </my:DigitLoopingSelector>

                    <TextBlock Grid.Column="1" Margin="0,0,0,0" TextWrapping="Wrap" Text="m" FontSize="48" VerticalAlignment="Center"/>
                    <my:DigitLoopingSelector 
                Grid.Column="2"
                Name="WidthCentimeterSelector" 
        ItemSize="108,108"
        ItemMargin="6,3" 
                MaxValue="99" StringFormat="D2"
                MinValue="0" HorizontalAlignment="Right" Margin="48,0,0,0" Width="108" IsExpanded="True" 
                >
                        <my:DigitLoopingSelector.ItemTemplate>
                            <DataTemplate>
                                <TextBlock 
                Text="{Binding BindsDirectlyToSource=True}" x:Name="secondText"
                FontSize="54" TextAlignment="Center" VerticalAlignment="Center"
                FontFamily="{StaticResource PhoneFontFamilySemiBold}"/>
                            </DataTemplate>
                        </my:DigitLoopingSelector.ItemTemplate>
                    </my:DigitLoopingSelector>
                    <TextBlock Grid.Column="3" Margin="0" TextWrapping="Wrap" Text="cm" FontSize="48" VerticalAlignment="Center"/>
                </Grid>
4

1 回答 1

4

问题是,我正在开发 wp8 应用程序,而我采用的 DigitLoopingSelector 控件属于旧版本。只需右键单击项目并将“属性”>“目标 Windows Phone 操作系统版本”更改为 OS 8.0,问题就解决了。

于 2013-08-22T12:35:49.220 回答