None of the templates in 3.0 RC1 for WP7 work for me

Mar 17, 2012 at 3:24 AM
Edited Mar 17, 2012 at 3:56 AM

When I first, started a new project with "Window Phone application with catel", the project started with 14 errors. Most of them where just because the refrences for the catel dlls weren't added.

 

Afterwards, I noticed that the sample template just wouldn't work normally. None of the binding was happening. I was able to run the application even though this error had shown at the bottom:  

 

"Error 1 Cannot create an instance of "PhoneApplicationPage". C:\Users\Shism\documents\visual studio 2010\Projects\Catel.WP7.WindowsPhoneApplication1\Catel.WP7.WindowsPhoneApplication1\Views\MainPage.xaml 1 1 Catel.WP7.WindowsPhoneApplication1"

 

When I restart visual studio, the designer also can't be opened because of:

 

"Error 1 Could not load type 'System.ComponentModel.IDataErrorInfo' from assembly 'System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. C:\Users\Shism\documents\visual studio 2010\Projects\Catel.WP7.WindowsPhoneApplication1\Catel.WP7.WindowsPhoneApplication1\Views\MainPage.xaml 1 1 Catel.WP7.WindowsPhoneApplication1"

 

After, closing the template application the designer in visual studio 2010 refused to open. I had to restart visual studio for the visual designer to start working again( it also just shows an error). It seems every time I run the templates( all of them cause the same issue) the designer stops functioning and I need to restart visual studio. What is causing this issue? Does catel support windows phone mango? I was really looking forward to use catel. Is there anyway you could release an installer that supports mango or could you show me how to build & use the necessary components for mango?

Coordinator
Mar 17, 2012 at 7:19 AM

I think you are trying the 2.5 templates? We will be releasing Catel 3.0 this weekend, and it will have new templates. All templates we tried for 3.0 are working out of the box (you indeed need to add the references first, via NuGet or manually).

Are you developing for Windows Phone or Windows Phone Mango? Catel 3.0 will only support Mango.

Coordinator
Mar 17, 2012 at 1:01 PM

I have tested with the latest templates.

1) Create WP7 application with Catel

2) Install nuget packages, for now I used "install-package catel.extensions.controls -includeprerelease"

3) Build => works like a charm

I can run the app in the emulator and on my phone, and all bindings seem to work.

Mar 17, 2012 at 2:12 PM

I am developing for Windows Phone Mango.  The current rc1 installer is not for mango right?

Coordinator
Mar 17, 2012 at 2:13 PM

Yes, it is for mango only, but we made some fixes for WP7 especially. It is called Catel.WP7, but that is Mango only.

Mar 17, 2012 at 2:16 PM

I'm trying to use the RC1 installer and get all of the errors shown above when trying to use the templates. 

Coordinator
Mar 17, 2012 at 2:19 PM

Are you using C# or VB.NET? And when installing the nuget packages, you do install the latest nuget prerelease packages, right? Or do you use the ones that ship with the RC 1?

I have uploaded the latest build of WP7 for you:

http://dl.dropbox.com/u/8455721/Catel_WP7_3.0.zip

Can you try these?

Mar 17, 2012 at 2:22 PM

I am using C#. I just used all the packages from RC1. I'll try the ones you provided right now.

Mar 17, 2012 at 2:24 PM

I would just use everything from the RC1 installer but use the files you uploaded right?

Coordinator
Mar 17, 2012 at 2:25 PM

Exactly, you create a new project using the template, then reference the assemblies in the zip package.

Mar 17, 2012 at 2:33 PM

I seem to get the same problem. The bindings aren't working.  I choose Windows Phone Application with Catel. The designer says "Problem Loading".

 

When I select "Reload the designer" I get these errors:

 

"Error 1 Nullable object must have a value. c:\users\shism\documents\visual studio 2010\Projects\Catel.WP7.WindowsPhoneApplication2\Catel.WP7.WindowsPhoneApplication2\Views\MainPage.xaml 1 1 Catel.WP7.WindowsPhoneApplication2"

 

"Error 2 Could not load type 'System.ComponentModel.IDataErrorInfo' from assembly 'System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. c:\users\shism\documents\visual studio 2010\Projects\Catel.WP7.WindowsPhoneApplication2\Catel.WP7.WindowsPhoneApplication2\Views\MainPage.xaml 1 1 Catel.WP7.WindowsPhoneApplication2"

Mar 17, 2012 at 2:34 PM
Edited Mar 17, 2012 at 2:36 PM

How is the template supposed to look? I don't see any mentions of any references to the viewmodel in the view.

 

This is what  I have :

<catel:PhoneApplicationPage x:Class="Catel.WP7.WindowsPhoneApplication2.Views.MainPage"
							xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
							xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
							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:catel="clr-namespace:Catel.Phone.Controls;assembly=Catel.MVVM" 
							mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
							FontFamily="{StaticResource PhoneFontFamilyNormal}"
							FontSize="{StaticResource PhoneFontSizeNormal}"
							Foreground="{StaticResource PhoneForegroundBrush}"
							SupportedOrientations="Portrait" Orientation="Portrait"
							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="*"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>
 
		<!--TitlePanel contains the name of the application and page title-->
		<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
			<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
			<TextBlock x:Name="PageTitle" Text="{Binding Title}" 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">
 
			<!-- Use this grid to place your real content -->
			
			<ListBox ItemsSource="{Binding Items}">
				<ListBox.ItemTemplate>
					<DataTemplate>
						<TextBlock Text="{Binding Name}" />
					</DataTemplate>
				</ListBox.ItemTemplate>
			</ListBox>
	
		</Grid>
 
		<!--Sample code showing usage of the bindable ApplicationBar of the Phone7.Fx.Preview assembly-->
		<!--<Preview:BindableApplicationBar Grid.Row="2" IsVisible="True" IsMenuEnabled="False">
			<Preview:BindableApplicationBarIconButton Command="{Binding Home}" IconUri="/Resources/Images/home.png" Text="Home" />
			<Preview:BindableApplicationBarIconButton Command="{Binding Add}" IconUri="/Resources/Images/add.png" Text="Add" />
			<Preview:BindableApplicationBarIconButton Command="{Binding Edit}" IconUri="/Resources/Images/edit.png" Text="Edit" />
			<Preview:BindableApplicationBarIconButton Command="{Binding Delete}" IconUri="/Resources/Images/delete.png" Text="Delete" />
		</Preview:BindableApplicationBar>-->
	</Grid>	
 
</catel:PhoneApplicationPage>
Coordinator
Mar 17, 2012 at 2:40 PM

ViewModels are located via the ViewModelLocator (see this documentation). But, I think I was looking at it the wrong way. I just created the project, ran it and changed some bindings. However, the designer indeed doesn't seem to work. Will fix that now.

Mar 17, 2012 at 2:49 PM
Edited Mar 17, 2012 at 2:51 PM

I fixed the problem I was having with the "Windows Phone Application with Catel". 

 

I put a breakpoint in : 

   public class DesignMainPageViewModel : MainPageViewModel
    {
        public DesignMainPageViewModel()
        {
            // Design data
            Items.Add(new ItemData("Design data 1"));
            Items.Add(new ItemData("Design data 2"));
            Items.Add(new ItemData("Design data 3"));
            Items.Add(new ItemData("Design data 4"));
            Items.Add(new ItemData("Design data 5"));
        }
    }


and noticed the breakpoint wasn't firing inside the function.It seems this function is never fired. So, I just put the adding items section inside the constructor of the mainpageviewmodel and everything started working. Why isn't this function firing?
Coordinator
Mar 17, 2012 at 2:55 PM

The designtime view model is only used when you set it via the d:DesignTimeDataContext property. I noticed that somehow, it is not in the template. I will fix the issue with the IDataErrorInfo tonight or tomorrow.

Coordinator
Mar 17, 2012 at 3:03 PM

I have updated the assemblies in the package. If you clean your project, rebuild then I can see a designer. Very weird, seems to be a known issue with WP7:

http://connect.microsoft.com/VisualStudio/feedback/details/694060/windows-phone-7-1-sdk-idataerrorinfo-xaml

Coordinator
Mar 17, 2012 at 3:19 PM

I have updated the nuget packages with the latest source, all seems to work now.

1) Create WP7 app

2) Install-package catel.extensions.controls -includeprerelease

3) Build => designer works

Sorry for the inconvenience.

Mar 17, 2012 at 3:22 PM

"The designtime view model is only used when you set it via the d:DesignTimeDataContext property. I noticed that somehow, it is not in the template. I will fix the issue with the IDataErrorInfo tonight or tomorrow."

 

Would you use it like this?:

"d:DesignTimeDataContext="Catel.WP7.WindowsPhonePivotApplication1.ViewsModels.MainPageViewModel"    

Do you think using d:DesignTimeDataContext allows  for the viewmodel to be found faster than letting the catel automatically resolve it?                       

 

 

"I have updated the assemblies in the package. If you clean your project, rebuild then I can see a designer. Very weird, seems to be a known issue with WP7:

http://connect.microsoft.com/VisualStudio/feedback/details/694060/windows-phone-7-1-sdk-idataerrorinfo-xaml"

 

The updated assemblies fix the designer issue. Where do I download them?


Mar 17, 2012 at 3:32 PM

Designer is up and running. Thanks Geertvan!

Mar 17, 2012 at 5:59 PM

It seems you fixed the problem where the designer is not working when starting up the project. After, loading the project sometimes the designer will do this now:

 

"System.TypeLoadExceptionCould not load type 'System.ComponentModel.IDataErrorInfo' from assembly 'System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'."

Mar 17, 2012 at 6:02 PM

This problem also appears when modifying some   properties of a ui control in the designer:

 

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************System.TypeLoadException: Could not load type 'System.ComponentModel.IDataErrorInfo' from assembly 'System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)   at System.Reflection.Assembly.GetType(String name)   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type)   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType()   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type)   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type)   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType()   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type)   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider.GetRuntimeType(Type reflectionType)   at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeType(Type reflectionType)   at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeType(Type reflectionType)   at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeType(Type reflectionType)   at MS.Internal.Metadata.ClrType.get_RuntimeMember()   at MS.Internal.Metadata.ClrMember`1.Microsoft.Windows.Design.Metadata.Reflection.IReflectionMember.get_MemberInfo()   at MS.Internal.Metadata.ClrType.Equals(Object obj)   at System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y)   at System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value)   at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.XamlMemberFor[TMember,TXaml](TMember member, Factory`2 factory)   at MS.Internal.Design.Metadata.Xaml.XamlType.<GetAllAttachableProperties>d__7.MoveNext()   at MS.Internal.Design.Metadata.Xaml.XamlType.<FindAttachableProperties>d__0.MoveNext()   at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<FindAttachableProperties>d__7.MoveNext()   at MS.Internal.VirtualModel.VirtualModelPropertyCollection.<GetUncachedProperties>d__0.MoveNext()   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)   at MS.Internal.VirtualModel.VirtualModelPropertyCollection.GetEnumerator()   at MS.Internal.Designer.PropertyEditing.ExtensibilityAccessor.GetAllSubProperties(ModelItem item)   at MS.Internal.Designer.PropertyEditing.ExtensibilityAccessor.GetSubProperties(ModelItem item)   at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyMerger.ModelItemPropertyExpander.<GetEnumerator>d__19.MoveNext()   at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyMerger.<GetFirstProperties>d__0.MoveNext()   at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyEntryCollection.CreateCollection(IEnumerable`1 mergedSubProperties, Boolean isMultiSelect, ModelPropertyEntryBase parentProperty)   at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyEntryCollection..ctor(ModelPropertyIndexer parentProperty)   at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyIndexer.get_SubProperties()   at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyValue.get_SubProperties()   at MS.Internal.Designer.PropertyEditing.FromExpression.Framework.PropertyInspector.CollectionDialogEditor.OnChildrenViewCurrentChanged(Object sender, EventArgs e)   at System.Windows.Data.CollectionView.OnCurrentChanged()   at MS.Internal.Data.EnumerableCollectionView._OnCurrentChanged(Object sender, EventArgs args)   at System.Windows.Data.CollectionView.OnCurrentChanged()   at System.Windows.Data.ListCollectionView.MoveCurrentToPosition(Int32 position)   at System.Windows.Data.CollectionView.MoveCurrentToFirst()   at MS.Internal.Data.EnumerableCollectionView.MoveCurrentToFirst()   at MS.Internal.Designer.PropertyEditing.FromExpression.Framework.PropertyInspector.CollectionDialogEditor.UpdateSelectedItem()   at MS.Internal.Designer.PropertyEditing.FromExpression.Framework.PropertyInspector.CollectionDialogEditor.Rebuild()   at MS.Internal.Designer.PropertyEditing.FromExpression.Framework.PropertyInspector.CollectionDialogEditor.PropertyValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)   at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)   at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)   at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)   at System.Windows.Data.BindingExpression.Activate(Object item)   at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)   at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)   at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)   at MS.Internal.Data.DataBindEngine.Run(Object arg)   at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)   at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()   at System.Windows.ContextLayoutManager.UpdateLayout()   at System.Windows.UIElement.UpdateLayout()   at System.Windows.Interop.HwndSource.SetLayoutSize()   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)   at System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)   at System.Windows.Forms.Control.WmCreate(Message& m)   at System.Windows.Forms.Control.WndProc(Message& m)   at System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Mar 17, 2012 at 6:03 PM

I also can't open the project in expression blend 4 any longer.

Mar 17, 2012 at 6:08 PM
Edited Mar 17, 2012 at 9:32 PM

The sample gives the wrong icon as well:

 

	<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
			<!--<shell:ApplicationBar.MenuItems>
				<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
				<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
			</shell:ApplicationBar.MenuItems>-->
			<shell:ApplicationBarIconButton  IconUri="/icons/appbar.refresh.rest.png" Text="Refresh"/>

Instead of the refresh icon, it instead shows the x icon with a another outer rounded rectangle.
Coordinator
Mar 19, 2012 at 7:33 AM

We will take a look at this.