Implement A Constructor In MVVM Unity?
Feb 28, 2012
I have just started using MVVM design pattern with unity and I'm strugling to work out how you add a constructor.my code currently works if I comment out my constructor that requires input the view gets added to the shell.
Protected Overrides Sub ConfigureModuleCatalog()
MyBase.ConfigureModuleCatalog()
Dim moduleCatalog As ModuleCatalog = CType(Me.ModuleCatalog, ModuleCatalog)
moduleCatalog.AddModule(GetType(GridModule))
End Sub
how do I pass in variables into my GridModule ?
View 5 Replies
ADVERTISEMENT
May 25, 2011
I have been getting up to speed with the MVVM pattern in Silverlight and was wondering how to implement binding from the View to the ViewModel when the ViewModel constructor has a parameter if an interface type.If I bind the viewmodel to the view in XAML then you can not use a parameterised constructor. Given that I was creating a default constructor passing an instance to the parameterised constructor but this breaks the abstraction.
View
<navigation:Page x:Class="QSmart.DataViewer.Report.RecentFailures.Report"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
[code]....
Is it recommended to use the code behind of the view to pass into the parameterised constructor and then bind to the viewmodel?
View 1 Replies
Jul 14, 2011
Possible Duplicate:How can I handle a Validation.Error in my ViewModel instead of my View's code behind?The usual examples of how to use Data-Validation in WPF usually only involves defining an error template for the control and displaying the error message in the control tooltip. What I want to do is to create a collection of all ValidationErrors, display it in an ItemsControl to the user and focus the invalid control when the user clicks on the associated (error) item in the ItemsControl.
View 2 Replies
Jul 19, 2010
I just would like to know how to implement class constructor in this language.
View 2 Replies
Feb 15, 2010
I have an abstract class which requires a delegate to function. I pass the delegate into the constructor. Now that I have a non default constructor I need to call the abstract class's constructors from the concrete class which means that I need to use MyBase.New(...). I have included a quick example below.
Public MustInherit Class BaseClass
Public Delegate Sub WorkMethod()
Private _Work As WorkMethod
[code]....
I have tried to do this but I keep getting the following error: "Implicit reference to object under construction is not valid when calling another constructor".Can I not do what I am trying to do above? I initially had the delegate setup in its own setter method. But then I am creating a deceptive API because it does require a point to a method to work properly.
View 3 Replies
Nov 2, 2009
what's the rationale behind this limitation: Constructor call is valid only as the first statement in an instance constructor i want to pass an argument to my constructor which validates this argument and calls mybase.new according to this argument but it doesn't let me
example:
Public Class prob
Inherits System.ApplicationException
Public Sub New(ByVal problem As String, ByRef inner_exception As Exception)
[code]....
View 16 Replies
Apr 14, 2010
I have problem when asking for default ILogger from Unity container. I have this setting defined in code (its VB.net)
Dim container As IUnityContainer
...
container.RegisterType(Of ILogger, NullLogger)()
[code].....
View 1 Replies
Oct 28, 2010
I'm trying to automatically register all reports in a unity container.All reports implement IReport and also have a Report() attribute which defines the title, description and unique key (so I can read these without instantiating a concrete class).So...I get the report types like this
Public Shared Function GetClassesWhichimplementInterface(Of T)() As IEnumerable(Of Type)
Dim InterfaceType = GetType(T)
Dim Types As IEnumerable(Of Type)[code]....
why the container isn't preserving the registration?
View 1 Replies
Sep 1, 2011
I have a "MenuService", which uses an "MenuRepository".When the MenuService is created, it loads correctly with the MenuRepository.Then it wants to save it in the UnityControllerFactory, but the MenuRepository in the MenuService is Nothing then (it wasn't before).Some additional info:I'm using the Unity and Repository pattern.The problem happens with a partial view (for a menu), which i have included in the "HomeController", it could be relevant information, so i included this, just in case:
Function Menu() As ActionResult
Return PartialView("~Views/Shared/_Menu.vbhtml", _MenuService.GetAllMenuItems)
End Function
Also, my partial "menu" view is like this:
~/_Menu.vbhtml
@ModelType IEnumerable(Of FacturatieMVCv2.Domain.Slave.MenuItem)
@*<div id="myslidemenu" class="jqueryslidemenu">*@
[code]....
And i'm calling the partial view with:
@Html.Action("Menu","Home")
View 1 Replies
Mar 14, 2011
I'm wondering if someone can point me towards a good article/tutorial explaining how to use the MVVM pattern in an WPF Application that uses WCF web services. My WPF client calls a service reference to get data objects that contain data from the database but from everything I've seen and read so far about MVVM I am still not clear on how to use MVVM to work with the data objects I am retrieving from the WCF services.
View 1 Replies
Sep 26, 2009
Almost every example of MVVM I found is coded in C#, are there any examples/tutorials coded in VB.Net? I'm having a hard time translating C# to VB.Net since I haven't really used C# in any meaningful way...Also, does a MVVM Template/Toolkit for VB.Net exist yet?
View 4 Replies
Feb 3, 2011
I am currently developing a new WPF application and have the majority of my business logic layer developed (ie my Models). I am about implement ViewModel classes to represent one feature of my application. I am quite new to the Model-View-ViewModel pattern and I have a question about which approach would be best to use when implementing my ViewModel classes.
[Code]...
View 3 Replies
Jun 7, 2011
I was wondering what the best approach is for sharing a menu across all wpf windows/views. My Application doesnt really fit the navigation model, so will probably use a Ribbon control. I am leaning towards creating a user control for the menu and dropping it on each view, but have also seen Josh Smith's msdn article, where he loads user controls.
View 2 Replies
Nov 11, 2009
IM Looking at Implementing MVVM in Silverlight.Kind of new to Silverlight and I'm Definately new to MVVM Pattern.I get it all But I want A set of small Prism VB.Net MVVM exmaples if that makes sense.
View 1 Replies
Mar 22, 2011
I have a simple LoginForm.Here is how the code-behind looks like:
Private Sub btnLogin_Click(sender As Object, e As RoutedEventArgs) _
Handles btnLogin.Click
If Me.loginForm.ValidateItem() Then
[code].....
View 1 Replies
Apr 15, 2012
I'm attempting to improve my MVVM abilities in my next WP7 App (which is written in Vb.NET). I have a textbox that has been given focus and has a WP7 keyboard displayed. I am using command binding and a xyzzer's bindable Application bar (which is excellent).[URL] I want to be able to cancel the focus of the TextBox from the ViewModel, by setting focus on the form. Normally (Non MVVM) I would do this from within the form by calling:
[Code]...
View 3 Replies
Feb 16, 2012
I'm trying to get a DataGridComboBoxColumn working with my ViewModel. Everything appears to work correctly but when I change the value of the combo box, the entity isn't changed. The datacontext of the window has these properties:
[Code]...
View 4 Replies
Sep 17, 2010
As my company migrates towards the .NET framework from VB6, it looks like we are going in the direction of WPF (my boss is in love with the Office-style Ribbon control). I've been working to mock one of our VB6 applications in WPF and decided to experiment with MVVM at the same time. I'm being discouraged from using an existing MVVM framework, so I guess I need to write my own. The biggest concern right now seems to be a method for registering and managing all my views from a central spot - a manager class - but I'm not exactly sure how to implement this.
View 4 Replies
Mar 26, 2012
SEE MY ANSWER AT THE BOTTOM Just doing some light reading on WPF where I need to bind the selectedItems from a DataGrid but I am unable to come up with anything tangible. I just need the selected objects.
[Code]...
View 3 Replies
Oct 12, 2010
I'm hacking away at some code which seems to have been started, at least in theory, as an MVVM project in Expression Blend, by my predecessor at this company.
I've got a thread running in the background, which is running some operations on items as they happen. In order to prevent any clashes, I've also got that thread running any operations my users call for.
Once those operations are completed, I'd like to bring up a MessageBox to give a summary of the user-initiated operations, but now that they're running off in their own thread, the finishedProcessing event handler is now running on the background thread instead of the interface thread and it's causing my MessageBoxes to appear non-modally.
Back in the WinForms days, I'd have handled that using InvokeRequired, Invoke and a Delegate. I've read that this has been replaced by something called "Dispatcher", but the ViewModel class I'm using doesn't seem to have a Dispatcher object.
The "thisViewModel" class I'm using inherits a class called "WorkspaceViewModel", which inherits "ViewModelBase", both of which look generated to me...
where I can link up to this "Dispatcher" from here?
View 1 Replies
Jan 4, 2011
How do i fill my ObservableCollection(of Monitors) with data so that I can save it in an MVVM friendly manner. I normally use a FileNumber to load a DataSet using a DataAdapter and pass the monitors table via monitorDT - should I be loading it differently? How do I save the changes? Right now I have the following for loading data:
[Code]...
View 1 Replies
Jan 13, 2011
How do i fill my ObservableCollection(of Monitors) with data so that I can save it in an MVVM friendly manner. I normally use a FileNumber to load a DataSet using a DataAdapter and pass the monitors table via monitorDT - should I be loading it differently? How do I save the changes?Right now I have the following for loading data:
Public Class Monitors
Inherits ObservableCollection(Of Monitor)
Public Shared Function LoadMonitors(ByVal monitorDT As DataTable) As Monitors
[code]....
View 3 Replies
Jul 4, 2011
Something that has been confusing me for a while now with WPF MVVM is for example, when I have a base model containing nothing but a few properties and some validation code and I then build a view model around this base model, how should the view model be structured.
For Example:
Base Model ->
Imports ModellingHelper
Imports FTNHelper
[Code]....
What I am wondering is, if there is a better way to structure the view model to improve data binding, so I don't have to bind to Source.Name etc. How should I handle the base model in the view model?
View 2 Replies
Mar 23, 2012
I have been trying to do this for ages and having no joy whatsoever.
I have a ribbon window of the following hierarchy:
MainWindow
MainContent (Tab Control)
TabContainerViewModel
ViewModelBase
View model base has an ObservableCollection of tabs type ViewModelBase. The Tab Control itself is binding fine to these, displaying appropriate view models. I have 2 problems however, I want a "NotepadView" (Of type viewmodelbase) to be replicated numerous times (one view many view models).
At the minute, I have 4 views (NotePadViewModelx where x is 1-4) with corresponding viewmodels, this is because each view had the same text per tab. Now I have individual views per tab.
When I type into tab 1 and switch to tab 2, I lose what I typed in tab one when I click back.
View 2 Replies
Mar 14, 2012
This is more a conceptual question. Here is my current predicament; I am writing a vb.net WPF application and using the MVVM pattern (love it! maintainability is just amazingly awesome). Currently all the code is written by hand and there is no use of NHibernate or Entity Framework as the backend is an access database (due to policy I cannot use NH and EF doesn't support JET Databases, we may switch to MSSQL at some point but that may be a while from now).[code]...
View 1 Replies
Jun 9, 2011
i want to execute a command if the KeyDown-event occurs. This command should only be fired if the Enter-Key was pressed.
View 2 Replies
May 4, 2012
Without using MVVMLight, I need to implement drag and drop for photos onto a listbox using mvvm using Icommands preferably and interaction triggers, however if i use commands then I don't know what to pass in for a command parameter? Any ideas? Thanks.
Heres some ideas I tried:
Public Property ImageList As New ObservableCollection(Of ListBoxItem)
Public Property AddImageCommand As ICommand = New Adjuster.DelegateCommand(AddressOf addImage)
Public Property DropCommand As ICommand = New Adjuster.DelegateCommand(AddressOf dropImage)
[code]....
View 1 Replies
Jan 4, 2011
I have a Master List in the DataGrid that displays all the "Monitors" - think of them as Audits (for context). Basically when a user clicks on a row in the DataGrid the TextBoxes, ComboBoxes, CheckBoxes and DatePickers all show the values and the user can edit them there and that all reflects in the DataGrid just fine.How do i go about using the same TextBoxes, ComboBoxes, CheckBoxes and DatePickers to add a new record?
<Monitor.VB>
Public Class Monitor
Public Property MID As Integer
Public Property FileNumber As String
[code]....
View 2 Replies
Mar 29, 2010
I have a program that tracks packages. Shipment and package entities are persisted in SQL database, and are displayed in a WPF view. Upon initial retrieval of the records, there is a noticeable pause before displaying the new shipments view, and I have not even implemented the code that counts shipments that are overdue/active yet (which will necessitate a tracking check via web service, and a lot of time).I have built this with the Ocean framework, and all appears to be doing well, except when I first started my foray into multi-threading. It broke, and it appeared to break something in Ocean... Here is what I did:
Private QueryThread As New System.Threading.Thread(AddressOf GetShipments)
Public Sub New()
' Insert code required on object creation below this point.
[code].....
View 1 Replies
Jul 22, 2009
When is it run? Does it run for each object to which I apply it, or just once? Can it do anything, or its actions are restricted?
View 3 Replies