This is a migrated thread and some comments may be shown as answers.

error "... cannot be converted to..."

7 Answers 262 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hong
Top achievements
Rank 1
Hong asked on 23 Jan 2014, 10:49 PM
When I replace a TextBox of a working app with RadTextBox, the designer is immediately messed up showing the following error:
 
ArgumentException: Object of type 'Telerik.Windows.Controls.GridLayoutPosition' cannot be converted to type 'Telerik.Windows.Controls.GridLayoutPosition'.

I am having a hard time to comprehend the meaning of this error. Any tip will be greatly appreciated.

Hong

7 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 27 Jan 2014, 12:34 PM
Hi Hong,

Thank you for contacting us. Could you please send us a sample project helping us reproduce the issue at our end? Code snippets are fine as well. Thank you in advance for your cooperation.

Regards,
Kiril Stanoev
TelerikIf you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
0
Hong
Top achievements
Rank 1
answered on 28 Jan 2014, 07:31 PM
To debug this, I created a simple page with nothing but RadTextBox added to the page that was automatically created by VS2012.  I use Telerik Control Panel to ensure that I have the latest packages.  The page is the following:

<phone:PhoneApplicationPage xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives" 
    x:Class="MyApp.Debug"
    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"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Controls:RadTextBox />
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>

The designer windows shows the following error:


Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
StackTrace
   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.Collection_InsertValue[T](PresentationFrameworkCollection`1 collection, UInt32 index, CValue value)
   at MS.Internal.XcpImports.Collection_InsertDependencyObject[T](PresentationFrameworkCollection`1 collection, UInt32 index, DependencyObject value)
   at System.Windows.PresentationFrameworkCollection`1.InsertDependencyObject(Int32 index, DependencyObject value)
   at System.Windows.Controls.UIElementCollection.InsertInternal(Int32 index, UIElement value)
InnerException: None




0
Hong
Top achievements
Rank 1
answered on 28 Jan 2014, 07:58 PM
Everything appears to be fine now.  Here is what I did:
1. Delete all Telerik references of the project.
2. Add a Telerik control by drag&drop.  This will add the correct reference automatically.
3. The error remains after step 2. Restart VS2012, and open the page with the Telerik control. The error is gone.

The error suddenly appeared again after I deleting a non-Telerik control of the page.  I restarted VS2012, and the error is gone.  My hunch is the following:
1. After updating the Telerik package, delete Telerik references of every project using Telerik controls, and add them back using the correct components.
2. Restart VS whenever the error occurs. 
0
Kiril Stanoev
Telerik team
answered on 29 Jan 2014, 12:52 PM
Hi Hong,

Thank you for the follow up. Sounds like a strange issue which we have not encountered before. We'll investigate the issue. In the meantime, if you have more details on the topic, let us know.

Regards,
Kiril Stanoev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
0
Manoj
Top achievements
Rank 1
answered on 08 Mar 2014, 11:48 AM
Thanks Hong
Restarting vs solved this problem. 
0
Hong
Top achievements
Rank 1
answered on 25 Jul 2014, 03:50 PM
Though restarting VS always solves the problem, but I have to restart VS2013 many times every day just for the sake of addressing this issue.
0
Tsvyatko
Telerik team
answered on 30 Jul 2014, 08:29 AM
Hello Hong,

you can simplify the process for restarting by restarting only the Xaml designer. Since Xaml designer is now separate process from VS is some occasions they does not synchronize correctly. Try closing "Microsoft Visual Studio XAML UI Designer" (XDesProc.exe) process  from Taskbar. This will force the designer process to restart.

Regards,
Tsvyatko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TextBox
Asked by
Hong
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Hong
Top achievements
Rank 1
Manoj
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or