|
|
Comments and Discussions
|
|
 |

|
If I try open MainWindows.xaml in the design (VS 2008) I get an error saying "Assembly 'Cinch' was not found. Verify you are...." for the line:
xmlns:Cinch="clr-namespace:Cinch;assembly=Cinch"
I also get it for the following one.
The project builds fine and runs. Am I doing something subtly wrong here?
Awesome framework though!
Cheers,
Robert
|
|
|
|

|
I think MainWindow does not quite know what to do with the View DataTemplates idea. Its not that easy to fix, many have complained but there is no known fix. Cinch V2 will slighly aid in this I hope. CInchV2 is coming really soon.
Sacha Barber
- Microsoft Visual C# MVP 2008-2010
- Codeproject MVP 2008-2010
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Whilst the framework clearly provides some very useful features I would be nervous of using it in anything other than throw-away personal projects due to the lack of tests, otherwise; how do we know it works?
|
|
|
|

|
It has tests, and use or not, thats your choice. Loads of people are using it and love it, I use at work. Whatever you like man.
Sacha Barber
- Microsoft Visual C# MVP 2008-2010
- Codeproject MVP 2008-2010
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
There is no need to be definsive but five test fixtures for an entire framework will not yield a high test coverage. Just my two pennies.
|
|
|
|

|
Each test case has loads of tests in it, and tests all of the ViewModels functions, so I know the framework is working.
Sacha Barber
- Microsoft Visual C# MVP 2008-2010
- Codeproject MVP 2008-2010
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
When I attempt to add a new customer I get the following pop-up:
'There was a problem fetching products'
Then the application locks up with close to 80% CPU usage.
I get the same problem when using the search customer feature:
'There was a problem fetching customers'
I have not dived into the code to see what is realling causing the problem.
The project was sucessfully converted to VS 2010 project with only two warnings, there was a missing assemble the Windows.Designer assembly, I replaced it with the Windows.Designer.Extensions assembly and everything compiled with out any errors.
Any ideas on what to possible cause of the problem is?
Or would you like me to debug it and get back to you since this is under 2010, and you are using 2008?
FYI: You still get a Five for this one!
~TheArch
|
|
|
|

|
Sorry to be the bearer of bad news here, but the demo app was a throw away. It should be seen as just that. I will not be maintaining it, what would happen if I get it into VS2010 and then someone says it does not work with VS2011.
It should be used as a reference of how to use Cinch only. The Cinch MVVM framework is the pay load of all those articles, if that does not work, I would want to know, but as for the demo app, its a vehicle to understanding Cinch is all, and there is a good documentation around Cinch, so the demo app is not the be all and end all. Obviously its sad, but life goes on.
I do not what would be causing it. That is my view right now, but I will more than likely look into it as some stage, just can't say when is all. I am very busy lad these days, but it does bother me of course, but I am just too stacked up right now, to look into everything people push my way.
Hope you understand that.
Sacha Barber
- Microsoft Visual C# MVP 2008-2010
- Codeproject MVP 2008-2010
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|
|
|

|
Hi Sacha
I was wondering what is the best way to implement an application wide undo redo?
What I mean by application wide is :
- multiple view can issue an undo/redo
- all the views get updated when an undo takes place
Would implementing an undo/redo manager as a service a good idea?
Any other suggestions?
thanks
|
|
|
|

|
Thats a very big question. I fall views are binding to the same data, the IEditableObject should be enough. But if you want true undo/redo you could use the Memento Pattern, or look for some other undo/redo framework. Its really to be a question for me to answer.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Hi,
We're trying to use your TabControlEx within our application in cohabitation with the MVVM pattern but instead of having it within a Window element we declared it within an UserControl element. The result is that the first displayed tab (the one added on the application's startup) is selected but has no content shown.
If you look at the visual tree (using snoop) the ContentPresenter that should be showing the view matching the selected workspace viewmodel just doesn't exists at all. The Grid has no children.
Digging further into the implementation of your TabControlEx we've found that when you reside within a Window first the data binding is done and the only the template is applied. Being within an UserControl works exactly the opposite, first the template is applied and then only the DataBinding is done.
This cause the template to be applied with an empty Items collection at this point of time.
We don't know if this could cause the problem of my "empty" tab as when we're using the native TabControl control directly also in combination with MVVM, DataTemplate and ViewModel it works ... Weirdo isn't ? Do Microsoft have a really hidden logic within its control that isn't called just by calling the base constructor? Or is their some hidden events that we're not able to overload or handle when overwriting the control?
Any thoughts or digging way would be really appreciated.
Thanks to anyone who used this TabControlEx to post their feedback.
Gautier
|
|
|
|

|
Add the following. For some reason, when used in a UC, you need to handle Loaded and Update the selected item. It appears that when the data bind is done, it adds a child to the PART_ItemsHolder, but then somewhere along the way, _itemsHolder.Children is cleared. I didn't look into it too much, but this should solve your issue.
public TabControlEx() : base()
{
// this is necessary so that we get the initial databound selected item
this.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
this.Loaded += TabControlEx_Loaded;
}
/// <summary>
/// in some scenarios we need to update when loaded in case the ApplyTemplate happens before
/// the databind.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void TabControlEx_Loaded(object sender, RoutedEventArgs e)
{
UpdateSelectedItem();
}
|
|
|
|

|
OK, I just dug into it a little bit more. The upshot is that in the UC case, the setting of the ItemsSource *after* ApplyTemplate causes a Refresh() of the CollectionView which the ItemsControl is using. The result of this is a CollectionChanged event with Action = Reset, which my code handles and clears _itemsHolder.Children.
So the bottom line is: handle Loaded and update the selected item, just in case.
|
|
|
|

|
THANK YOU!!!!!!!!!!!!! I have been looking for a solution for this for a long time.
|
|
|
|

|
Hi handling this.Loaded and calling UpdateSelectedItem() don't work for me
I use try this with john smith article http://msdn.microsoft.com/en-us/magazine/dd419663.aspx[^]
if in the code of the article I use TabControlEx and try to show the first tab at start-up (without the user click show-all-customer button) the first table is not displayed
..seems that the OnItemsChanged event with NotifyCollectionChangedAction.Reset arg cause _itemsHolder.Children.Clear(); ..this after control loaded and after windows.show() exit
note that if I dont try to show the first tab at start-ip and then click to the button show-all-customer all work fine
..I was not able to solve this
thanks
|
|
|
|

|
I'm getting the following error adding orders to customers
"ex = {"The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_Order_Order\". The conflict occurred in database \"MVVM_Demo\", table \"dbo.Customer\", column 'CustomerId'.\r\nThe statement has been terminated."}"
I looked in the debugger to find the CustomerID is not being populated in the CurrentCustomerOrder in the ExecuteSaveOrderCommand.
I haven't dug through to see what is wrong. I can edit orders that are manually created in the db.
Thanks for the work!
|
|
|
|

|
I cant repeat this, I think this may be fixed by some change I did the other day, but am yet to upload to codeplex.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
First, i would like to say it is Great job, Thanks.
Can you give us your recomendation on using EF with this Framework, we will apreciatie it if you give us some example code in doing this.
thanks in advance.
|
|
|
|

|
Yeah so what you would do if you want to use EF with Cinch, is just inherit from the ViewModels and add the properties to match the Model to the ViewModels.
I do not have time (I am a very busy man) for a code example, but it would be very easy to do, just create the model in EF (which in my mind is a service layer thing, so how would these get to the UI, via WCF, so would you need to reference the same EF dll on both client and service side).
And then create a ViewModel and add the properties you need to match the model and follow the instructions contained in all these articles. If you can wait a week I will have a complete code generator coming out for Cinch, that will help you enormously.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Ok, thanks Sacha. To me that's good news. I will wait to try using it, good luck.
Regards,
Mukhtar Zayed.
|
|
|
|

|
I can tell you I am sure there will be no issues using it with EF at all, you will just have to create ViewModels over the EF models, but that is what Cinch is all about in a way.
I really think once you see the code generator in action you will just get what I mean.
Have a look at my blog to see some advanced screen shots showing what it will be like (its nearly done).
http://sachabarber.net/?p=546[^]
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Hi Sacha,
thank you again for your fast reply, i did see the code generator screen shoots, it looks nice.
I'm burning to try it really.
to use EF, i did modify the DataService Class to support Entities as illustrated below, and left the rest as it is.
public static List<CustomerDAL.Customer> FetchAllCustomers()
{
CustomerEntities context = new CustomerEntities();
return context.Customers.ToList();
}
am i right ?
by the way i have got the same error mentioned earlier "I get error when I open MainWindow.xaml"
in design time, but it works when you hit F5.
Thank You.
|
|
|
|

|
yeah that should be the way.
The thing is the demo app was just a small demo, it is not how I would ideally structure my system. I would have data objects come from some service such as WCF, these objects would then be used to create the ViewModels to drive the UI.
In the demo app all the code is in one solution, and the teirs all all part of the demo Client UI app. This is not what you would want in real life I feel.
But yeah you could use the DataAccess layer behind a WCF service and it should still be ok.
Dont know about design time issue, to be honest I hand code my XAML so never work with the designer.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Hi Sacha,
I want to ask you, when I open MainWindow.xaml, it shows "Could not create an instance of type 'AddEditCustomerView'", in follow code:
local:AddEditCustomerView
local:SearchCustomersView
How I can fix this?
Thanks and Best regards.
Cuong,
|
|
|
|

|
Strange this works for me
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Sacha,
Firstly thank you for all the amazing things you put together for us in the growing world of WPF. I am grateful for your amazing work, you are the best.
Working my way through Cinch but I also get the "Could not create an instance of type 'AddEditCustomerView'" error. Any ideas? The application will run just can't edit the MainWindow.xaml page. Problem is for the local: line
<DataTemplate DataType="{x:Type VM:AddEditCustomerViewModel}">
<AdornerDecorator>
<local:AddEditCustomerView />
</AdornerDecorator>
</DataTemplate>
The second Cinch in the xmlns line is red, with a tooltip saying "Cannot resolve symbol 'Cinch'"
xmlns:Cinch="clr-namespace:Cinch;assembly=Cinch"
If I try to add a reference to Cinch it enters exactly the same format but says it cannot resolve it.
Thanks,
Nigel Stratton
|
|
|
|

|
To resolve the issue it is necessary to replace "StaticResource" keyword to "DynamicResource" in following places:
<SearchCustomersView.xaml>
Style="{StaticResource ValidatingTextBox}"
ItemContainerStyle="{StaticResource ListViewContainer}"
ColumnHeaderContainerStyle="{StaticResource GridViewColumnHeaderStyle}">
ItemContainerStyle="{StaticResource ContextMenuItemStyle}"
<AddEditCustomerView.xaml>
All instances of StaticResource have to be replaced with DynamicResource
modified on Wednesday, November 18, 2009 1:33 PM
|
|
|
|

|
I also received this same error.
|
|
|
|

|
Hi Sacha,
on your demo app, when an edit is canceled, the view is not updated (the canceled changes are still displayed until the view is recreated). Is this an expected behavior ?
Thanks for sharing
Fred (from France)
|
|
|
|

|
Yeah it kind of is, but now that you mention it it probably needs looking at. Il put it on the list.
Thanks for pointing it out.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
I have fixed this and updated code, which I will be updating on site soon.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Cool !
|
|
|
|

|
Hi Sacha,
I saw you've updated your code. It's ok for views related to orders but customer's list view still need refresh after a cancelled edition.
However, your demo is very impressive and useful to learn mvvm principles !
|
|
|
|

|
I checked out the Customers and that is right in my opinion, what happens is that the Customer being edited is closed, which is right.
no cars go wrote: However, your demo is very impressive and useful to learn mvvm principles !
You know one thing I should say, the demo is just that, it is just a demo, the real payload was the Cinch.Dll. I have had people criticise my unit tests and say they are sh*t and they are not granular enough (they are one test per command I dont know how much more granular they can be).
Anyway what I mean is criticism is fine and if it is plainly wrong like the one you stated was, that's fine, but don't miss the point, which is how to develop MVVM apps using Cinch.
I am currently working on improving it all a bit actually and am concentrating on making DataWrappers easier to work with, and am also 90% done with creating a code generator that creats Cinch ViewModels rather nicely.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
In ViewModelBase.cs
/// <summary>
/// UnloadedCommand : Window/UserControl Lifetime command
/// </summary>
public SimpleCommand UnloadedCommand
{
get { return loadedCommand; }
}
|
|
|
|

|
Shite, Ill fix that, soon and re-upload
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
This should be done in 1 minute
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Hello Sacha,
i very impressive, great job.
I want to ask you, do you have same project but to Silverlight???
I looking projects like this to silverlight in vb or C#.
fausto
|
|
|
|

|
Sadly no. Best bet is use Laurents SL framework
http://www.galasoft.ch/mvvm/getstarted/[^]
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Hi, Sacha
How to add Separater to WPFMenuItem?
Thanks
|
|
|
|

|
Yeah that would be hard using Cinchs approach, I dont think that would be possible. You could maybe do it using a ValueConverter, but other than that I don't think it would be possible.
Its a trade off, of course, being able to do everything in ViewModel sometimes means making sacrifices in some areas.
I think Karl may have touched on this in his article
http://karlshifflett.wordpress.com/2008/02/03/wpf-sample-series-databound-hierarchicaldatatemplate-menu-sample/[^]
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
5 again
Enjoy Life,
Rajesh Pillai
http://rajeshpillai.blogspot.com/
http://simply-url.blogspot.com/
|
|
|
|

|
Thanks man
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Sacha, I seem to be having a bit of an issue with a missing dependency for the Cinch project file on:
Microsoft.VisualStudio.TeamSystem.Data.UnitTesting
I have VS 2008 Team System Development Edition installed on my system. I'm wondering if this missing dependency is from a different version of Visual studio - IIRC, there's a number of different team system versions.
Do you know if that's the reason I'm missing the dependency?... I'm wondering where I could get a hold of this assembly.
Also, I notice that the references from the various project files in the demo solution to Cinch are binary references. I was wondering particularly given the solution includes the Cinch project, wouldn't it be better for these references to be project references instead?
Thanks,
Phil
|
|
|
|

|
Hmm, is the TeamSystem.Data.UnitTesting really a dependency? I just removed this assembly reference and rebuilt the solution, and it built without errors.
Phil
|
|
|
|

|
That seems to be weird, that could be a TFS thing. I actually built the app at home using Test Driven .NET and that is the reference that should be used.
As far as Binary vs Project references, I just do it like that, change that if you like it shouldn't matter.
Sacha Barber
- Microsoft Visual C# MVP 2008/2009
- Codeproject MVP 2008/2009
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|

|
Thanks Sacha.
Another quick question ..
Do you use the cider editor for design? I can view most of the demo app's views (AddEditCustomerView) etc. in the cider designer but with the main window (MainWindow) the cider designer is complaining of being unable to create an instance of AddEditCustomerView.
Having attached another debugger to the visual studio process, what's causing it problems is the references from these views (AddEditCustomerView) to resources included by App.xaml.
I think I've seen this kind of thing previously and the way I've gotten around it sometimes is to use DynamicResource references instead of StaticResource.
Do you have any recommendations on this? Just avoid using cider completely? Change all the problematic references to use DynamicResource (looks like there might be quite a few).
Or am I just doing something stupid?
Thanks again,
Phil
|
|
|
|

|
And I guess, another alternative would be to duplicate the merge resource dictionary references into each of the user controls resource dictionaries. Ugly, but I've done this kind of thing before in order to have the designer reflect theme styling when editing user controls.
The cider designer has a long way to go...
Phil
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
It would probably be like Cinch, an MVVM framework for WPF.
| Type | Article |
| Licence | CPOL |
| First Posted | 12 Aug 2009 |
| Views | 75,465 |
| Downloads | 0 |
| Bookmarked | 57 times |
|
|