Search Results

Search found 1226 results on 50 pages for 'kendo mvvm'.

Page 5/50 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Why should I use MVVM when it breaks built in riaservices functionality

    - by Jakob
    I'm struggling to grasp why MVVM is really a good pattern to implement in riaserivces, To me there's nothing but trouble to it, it just add's another tier that I have to code. I Get that I could change the UI, but really I don't need to. Instead i won't be able to user out of the box functionality with riaservices, datagrid, dataform all controls require some implementation. Why can't it just be simple? Is there really no way to get MVVM to automatically set "IsBusy" and all the dataform edit functionality. It's like reinventing the wheel to me, and it seems that I'd be able to write code much faster just using riaservices

    Read the article

  • Windows Phone 7, MVVM, Silverlight and navigation best practice / patterns and strategies

    - by Matt F
    Whilst building a Windows Phone 7 app. using the MVVM pattern we've struggled to get to grips with a pattern or technique to centralise navigation logic that will fit with MVVM. To give an example, everytime the app. calls our web service we check that the logon token we've assigned the app. earlier hasn't expired. We always return some status to the phone from the web service and one of those might be Enum.AuthenticationExpired. If we receive that I'd imagine we'd alert the user and navigate back to the login screen. (this is one of many examples of status we might receive) Now, wanting to keep things DRY, that sort of logic feels like it should be in one place. Therein lies my question. How should I go about modelling navigation that relies on (essentially) switch or if statements to tell us where to navigate to next without repeating that in every view. Are there recognised patterns or techniques that someone could recommend? Thanks

    Read the article

  • Real winforms/wpf projects which use MVC, MVP, MVVM

    - by Belousov Pavel
    Hello everybody, I have looked some videos and read some articles about MVC, MVP, MVVM. I think, that I understood basic principles and differences. But it seems to me that samples in articles and videos are very easy. I think that it's easy to learn how to apply these patterns when you can look on some projects. So I'd like to look on real projects(Winforms/WPF), which use MVC, MVP or MVVM. Could you provide me links to sources of such projects? (If it is open source) It will be great if projects will have unit tests for Controller/Presenter/ViewModel, because it's one of my problem when I develop applications. Thanks in advance.

    Read the article

  • problem in basic implementation of MVVM pattern - Services

    - by netmajor
    I watch some video and read articles about MVVM pattern and start thinking how should I implement it in my Silverlight app. So at first I create Silverlight application. I think that for clear view I create 3 folders: View - for each user control page in my app, ViewModel - for c# class which will querying date and Model- Entity Data Model of my SQL Server or Oracle Database. And now I am confused, cause I want to implement *WCF/RIA Services/Web services* in my project. In which folder should I put in class of services? I see in examples that Services take date and filtering it and then output data was binding in View - so It looks as ViewModel. But I was sure that someone use Services in Model and that I want to do. But how? Can someone explain me implementing Services as Model? Is my point of view at MVVM is correctly?

    Read the article

  • MVVM (ICommand) in Silverlight

    - by Andrey Khataev
    Hello! Please, don't judge strictly if this question was discussed previously or indirectly answered in huge nearby prism and mvvm blogs. In WPF implementation of RelayCommand or DelegateCommand classes there is a such eventhandler /// <summary> /// Occurs whenever the state of the application changes such that the result of a call to <see cref="CanExecute"/> may return a different value. /// </summary> public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } but in SL subset of namespaces there are no CommandManager class. And this is where I'm stuck. I haven't yet found an workaround for this in MVVM adoptation for SL (PRISM is so complex for me yet). Different simple HelloWorldMVVM apps don't deal with at all. Thanks in advance and sorry for my English -)

    Read the article

  • Binding command to button in silverlight 4 using mvvm

    - by Archie
    Hello, I have a user control called HomePage.xaml. I'm creating a model instance (using MVVM pattern) in the code behind file in the constructor of page as MainViewModel model = new MainViewModel(); I have a button in HomePage.xaml which I want to bind to the command inside MainViewModel called GetData() and want to populate the data in datagrid. MainViewModel has an ObservableCollection which I would use to bind the data in datagrid. Populating the data in datagrid without binding command works fine. I'm binding the button as: <StackPanel x:Name="stkPanelInput" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"> <Button x:Name="buttonGetData" Width="70" Content="GetData" Command="{Binding GetData}" Click="buttonGetData_Click"/> </StackPanel> How shall I bind the command using MVVM? Thanks.

    Read the article

  • MVVM View reference to ViewModel

    - by BrettRobi
    I'm using MVVM in a WPF app. I'm very new to both. Let me state that I am not a purest in the MVVM pattern, I am trying to use as many best practices as I can but am trying to make what I think are reasonable compromises to make it work in our environment. For example, I am not trying to achieve 0% code in my View codebehind. I have a couple of questions about best practices. 1) I understand I don't want my VM to know about the attached View, but is it reasonable for the View to have a reference to its VM? 2) If a control in a View opens another View (such as a dialog) should I handle this in the View? It seems wrong to handle it in the VM since then the VM has some knowledge of a specific View.

    Read the article

  • Why should I use MVVM when it breaks built in functionality

    - by Jakob
    I'm struggling to grasp why MVVM is really a good pattern to implement in riaserivces, To me there's nothing but trouble to it, it just add's another tier that I have to code. I Get that I could change the UI, but really I don't need to. Instead i won't be able to user out of the box functionality with riaservices, datagrid, dataform all controls require some implementation. Why can't it just be simple? Is there really no way to get MVVM to automatically set "IsBusy" and all the dataform edit functionality. It's like reinventing the wheel to me, and it seems that I'd be able to write code much faster just using riaservices

    Read the article

  • What is the best practice for accessing Model using MVVM pattern

    - by Dzenand
    I have a database that communicates with webservices with my Model (own thread) and exposes Data Objects. My UI application consists of different Views and ViewModels and Custom Controls. I'm using ServiceProvider (IServiceProvider) to access the Model and route the events to the UI thread. Communication between the ViewModels is handeled by a Messenger. Is this way to go? I was also wondering what is the best way to strucutre the DataObjects At the moment i have the DataObjects that have a hierarchy structure but does not support INotifyProperty though the children list are of type of ObservableCollection. I have no possiblity to implement notifypropertychange on the properties. I was wondering the best way of making them MVVM friendly. Implementing a partial class and adding all the properties or commands that are necessary or wrapping all the DataObjects and keep the Model list and MVVM list in sync. All thoughts and ideas are appreciated.

    Read the article

  • WPF MVVM - Correct way to consume a web service asynchronously

    - by byte
    I have implemented MVVM in my WPF application. I was wondering what is the correct way to consume a Web Service from WPF MVVM app. So far, I have created a DataAccess interface and a class that implements this interface. This would serve as a facade / proxy to the web service. The ViewModel gets a reference to this class as the constructor parameter so it can make any calls to get/set data, in this case it will be a Web service call. I would appreciate if you can guide me with some hints and / or direct me to some online resource.

    Read the article

  • Combining MVVM Light Toolkit and Unity 2.0

    - by Alan Cordner
    This is more of a commentary than a question, though feedback would be nice. I have been tasked to create the user interface for a new project we are doing. We want to use WPF and I wanted to learn all of the modern UI design techniques available. Since I am fairly new to WPF I have been researching what is available. I think I have pretty much settled on using MVVM Light Toolkit (mainly because of its "Blendability" and the EventToCommand behavior!), but I wanted to incorporate IoC also. So, here is what I have come up with. I have modified the default ViewModelLocator class in a MVVM Light project to use a UnityContainer to handle dependency injections. Considering I didn't know what 90% of these terms meant 3 months ago, I think I'm on the right track. // Example of MVVM Light Toolkit ViewModelLocator class that implements Microsoft // Unity 2.0 Inversion of Control container to resolve ViewModel dependencies. using Microsoft.Practices.Unity; namespace MVVMLightUnityExample { public class ViewModelLocator { public static UnityContainer Container { get; set; } #region Constructors static ViewModelLocator() { if (Container == null) { Container = new UnityContainer(); // register all dependencies required by view models Container .RegisterType<IDialogService, ModalDialogService>(new ContainerControlledLifetimeManager()) .RegisterType<ILoggerService, LogFileService>(new ContainerControlledLifetimeManager()) ; } } /// <summary> /// Initializes a new instance of the ViewModelLocator class. /// </summary> public ViewModelLocator() { ////if (ViewModelBase.IsInDesignModeStatic) ////{ //// // Create design time view models ////} ////else ////{ //// // Create run time view models ////} CreateMain(); } #endregion #region MainViewModel private static MainViewModel _main; /// <summary> /// Gets the Main property. /// </summary> public static MainViewModel MainStatic { get { if (_main == null) { CreateMain(); } return _main; } } /// <summary> /// Gets the Main property. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This non-static member is needed for data binding purposes.")] public MainViewModel Main { get { return MainStatic; } } /// <summary> /// Provides a deterministic way to delete the Main property. /// </summary> public static void ClearMain() { _main.Cleanup(); _main = null; } /// <summary> /// Provides a deterministic way to create the Main property. /// </summary> public static void CreateMain() { if (_main == null) { // allow Unity to resolve the view model and hold onto reference _main = Container.Resolve<MainViewModel>(); } } #endregion #region OrderViewModel // property to hold the order number (injected into OrderViewModel() constructor when resolved) public static string OrderToView { get; set; } /// <summary> /// Gets the OrderViewModel property. /// </summary> public static OrderViewModel OrderViewModelStatic { get { // allow Unity to resolve the view model // do not keep local reference to the instance resolved because we need a new instance // each time - the corresponding View is a UserControl that can be used multiple times // within a single window/view // pass current value of OrderToView parameter to constructor! return Container.Resolve<OrderViewModel>(new ParameterOverride("orderNumber", OrderToView)); } } /// <summary> /// Gets the OrderViewModel property. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This non-static member is needed for data binding purposes.")] public OrderViewModel Order { get { return OrderViewModelStatic; } } #endregion /// <summary> /// Cleans up all the resources. /// </summary> public static void Cleanup() { ClearMain(); Container = null; } } } And the MainViewModel class showing dependency injection usage: using GalaSoft.MvvmLight; using Microsoft.Practices.Unity; namespace MVVMLightUnityExample { public class MainViewModel : ViewModelBase { private IDialogService _dialogs; private ILoggerService _logger; /// <summary> /// Initializes a new instance of the MainViewModel class. This default constructor calls the /// non-default constructor resolving the interfaces used by this view model. /// </summary> public MainViewModel() : this(ViewModelLocator.Container.Resolve<IDialogService>(), ViewModelLocator.Container.Resolve<ILoggerService>()) { if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { // Code runs "for real" } } /// <summary> /// Initializes a new instance of the MainViewModel class. /// Interfaces are automatically resolved by the IoC container. /// </summary> /// <param name="dialogs">Interface to dialog service</param> /// <param name="logger">Interface to logger service</param> public MainViewModel(IDialogService dialogs, ILoggerService logger) { _dialogs = dialogs; _logger = logger; if (IsInDesignMode) { // Code runs in Blend --> create design time data. _dialogs.ShowMessage("Running in design-time mode!", "Injection Constructor", DialogButton.OK, DialogImage.Information); _logger.WriteLine("Running in design-time mode!"); } else { // Code runs "for real" _dialogs.ShowMessage("Running in run-time mode!", "Injection Constructor", DialogButton.OK, DialogImage.Information); _logger.WriteLine("Running in run-time mode!"); } } public override void Cleanup() { // Clean up if needed _dialogs = null; _logger = null; base.Cleanup(); } } } And the OrderViewModel class: using GalaSoft.MvvmLight; using Microsoft.Practices.Unity; namespace MVVMLightUnityExample { /// <summary> /// This class contains properties that a View can data bind to. /// <para> /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel. /// </para> /// <para> /// You can also use Blend to data bind with the tool's support. /// </para> /// <para> /// See http://www.galasoft.ch/mvvm/getstarted /// </para> /// </summary> public class OrderViewModel : ViewModelBase { private const string testOrderNumber = "123456"; private Order _order; /// <summary> /// Initializes a new instance of the OrderViewModel class. /// </summary> public OrderViewModel() : this(testOrderNumber) { } /// <summary> /// Initializes a new instance of the OrderViewModel class. /// </summary> public OrderViewModel(string orderNumber) { if (IsInDesignMode) { // Code runs in Blend --> create design time data. _order = new Order(orderNumber, "My Company", "Our Address"); } else { _order = GetOrder(orderNumber); } } public override void Cleanup() { // Clean own resources if needed _order = null; base.Cleanup(); } } } And the code that could be used to display an order view for a specific order: public void ShowOrder(string orderNumber) { // pass the order number to show to ViewModelLocator to be injected //into the constructor of the OrderViewModel instance ViewModelLocator.OrderToShow = orderNumber; View.OrderView orderView = new View.OrderView(); } These examples have been stripped down to show only the IoC ideas. It took a lot of trial and error, searching the internet for examples, and finding out that the Unity 2.0 documentation is lacking (at best) to come up with this solution. Let me know if you think it could be improved.

    Read the article

  • Is it possible for the View to subscribe ViewModel CLR event?

    - by Vincent Leung
    Sometimes a view model needs to raise notifications, that a view should handle and do something in response, esp. when these can't be modeled as properties and property change notifications. Anything in MVVM Light that can allow the view to listen to events and translate view model notifications into user interface actions via declarative Xaml markup?

    Read the article

  • Silverlight TV 13: MVVM Light Toolkit

    The latest episode of Silverlight TV is now available on Channel 9! In this episode, Silverlight MVP Laurent Bugnion of IdentityMine appears on the show to discuss using MVVM with Silverlight. Laurent and John discuss their experiences with MVVM and how Laurent's experiences inspired him to create his MVVM Light Toolkit. If you have been meaning to get into MVVM or you feel a bit overwhelmed by it all, definitely watch this episode and check out the MVVM Light Toolkit. Links for this episode:...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • MVVM/Presentation Model With WinForms

    - by Erik Ashepa
    Hi, I'm currently working on a brownfield application, it's written with winforms, as a preparation to use WPF in a later version, out team plans to at least use the MVVM/Presentation model, and bind it against winforms... I've explored the subject, including the posts in this site (which i love very much), when boiled down, the main advantage of wpf are : binding controls to properties in xaml. binding commands to command objects in the viewmodel. the first feature is easy to implement (in code), or with a generic control binder, which binds all the controls in the form. the second feature is a little harder to implement, but if you inherit from all your controls and add a command property (which is triggered by an internal event such as click), which is binded to a command instance in the ViewModel. The challenges I'm currently aware of are : implementing a commandmanager, (which will trigger the CanInvoke method of the commands as necessery. winforms only supports one level of databinding : datasource, datamember, wpf is much more flexible. am i missing any other major features that winforms lacks in comparison with wpf, when attempting to implement this design pattern? i sure many of you will recommend some sort of MVP pattern, but MVVM/Presentation model is the way to go for me, because I'll want future WPF support. Thanks in advance, Erik.

    Read the article

  • WPF MVVM ComboBox SelectedItem or SelectedValue not working

    - by cjibo
    Update After a bit of investigating. What seems to be the issue is that the SelectedValue/SelectedItem is occurring before the Item source is finished loading. If I sit in a break point and weight a few seconds it works as expected. Don't know how I'm going to get around this one. End Update I have an application using in WPF using MVVM with a ComboBox. Below is the ViewModel Example. The issue I'm having is when we leave our page and migrate back the ComboBox is not selecting the current Value that is selected. View Model public class MyViewModel { private MyObject _selectedObject; private Collection<Object2> _objects; private IModel _model; public MyViewModel(IModel model) { _model = model; _objects = _model.GetObjects(); } public Collection<MyObject> Objects { get { return _objects; } private set { _objects = value; } } public MyObject SelectedObject { get { return _selectedObject; } set { _selectedObject = value; } } } For the sake of this example lets say MyObject has two properties (Text and Id). My XAML for the ComboBox looks like this. XAML <ComboBox Name="MyComboBox" Height="23" Width="auto" SelectedItem="{Binding Path=SelectedObject,Mode=TwoWay}" ItemsSource="{Binding Objects}" DisplayMemberPath="Text" SelectedValuePath="Id"> No matter which way I configure this when I come back to the page and the object is reassembled the ComboBox will not select the value. The object is returning the correct object via the get in the property though. I'm not sure if this is just an issue with the way the ComboBox and MVVM pattern works. The text box binding we are doing works correctly.

    Read the article

  • Using Unit of Work design pattern / NHibernate Sessions in an MVVM WPF

    - by Echiban
    I think I am stuck in the paralysis of analysis. Please help! I currently have a project that Uses NHibernate on SQLite Implements Repository and Unit of Work pattern: http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/10/nhibernate-and-the-unit-of-work-pattern.aspx MVVM strategy in a WPF app Unit of Work implementation in my case supports one NHibernate session at a time. I thought at the time that this makes sense; it hides inner workings of NHibernate session from ViewModel. Now, according to Oren Eini (Ayende): http://msdn.microsoft.com/en-us/magazine/ee819139.aspx He convinces the audience that NHibernate sessions should be created / disposed when the view associated with the presenter / viewmodel is disposed. He presents issues why you don't want one session per windows app, nor do you want a session to be created / disposed per transaction. This unfortunately poses a problem because my UI can easily have 10+ view/viewmodels present in an app. He is presenting using a MVP strategy, but does his advice translate to MVVM? Does this mean that I should scrap the unit of work and have viewmodel create NHibernate sessions directly? Should a WPF app only have one working session at a time? If that is true, when should I create / dispose a NHibernate session? And I still haven't considered how NHibernate Stateless sessions fit into all this! My brain is going to explode. Please help!

    Read the article

  • ListView + MultipleSelect + MVVM = ?

    - by Dave
    If I were to say "the heck with it!", I could just give my ListView with SelectionMode="Multiple" a name, and be able to get all of the selected items very easily. But I'm trying to stick to MVVM as much as possible, and I want to somehow databind to an ObservableCollection that holds the value from the Name column for each selected item. How in the world do you do this? Single selection is simple, but the multi selection solution is not obvious to me with my current WPF / MVVM knowledge. I read this question on SO, and while it does give me some good insight, I don't know how to add the necessary binding to a row, because I am using a ListView with a GridView as its View, not a ListBox. Here's what my XAML basically looks like: <ListView DockPanel.Dock="Top" ItemsSource="{Binding ClientPreview}" SelectionMode="Multiple"> <ListView.View> <GridView AllowsColumnReorder="False"> <GridViewColumn Header="Name"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name}" /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Address"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Address}" /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView> It sounds like the right thing to do is to databind each row's IsSelected property to each object stored in the ObservableCollection I'm databinding to. I just haven't figured out how to do this.

    Read the article

  • FxCop hates my usage of MVVM

    - by Dave
    I've just started to work with FxCop to see how poorly my code does against its full set of rules. I'm starting off with the "Breaking" rules, and the first one I came across was CA2227, which basically says that you should make a collection property's setter readonly, so that you can't accidentally change the collection data. Since I'm using MVVM, I've found it very convenient to use an ObservableCollection with get/set properties because it makes my GUI updates easy and concise in the code-behind. However, I can also see what FxCop is complaining about. Another situation that I just ran into is with WF, where I need to set the parameters when creating the workflow, and I'd hate to have to write a wrapper class around the collection I'm using just to avoid this particular error message. For example, here's a sample runtime error message that I get when I make properties readonly: The activity 'MyWorkflow' has no public writable property named 'MyCollectionOfStuff' What are you opinions on this? I could either ignore this particular error, but that's probably not good because I could conceivably violate this rule elsewhere in the code where MVVM doesn't apply (model only code, for example). I think I could also change it from a property to a class with methods to manipulate the underlying collection, and then raise the necessary notification from the setter method. I'm a little confused... can anyone shed some light on this?

    Read the article

  • WPF MVVM Chart change axes

    - by c0uchm0nster
    I'm new to WPF and MVVM. I'm struggling to determine the best way to change the view of a chart. That is, initially a chart might have the axes: X - ID, Y - Length, and then after the user changes the view (either via lisbox, radiobutton, etc) the chart would display the information: X - Length, Y - ID, and after a third change by the user it might display new content: X - ID, Y - Quality. My initial thought was that the best way to do this would be to change the bindings themselves. But I don't know how tell a control in XAML to bind using a Binding object in the ViewModel, or whether it's safe to change that binding in runtime? Then I thought maybe I could just have a generic Model that has members X and Y and populate them as needed in the viewmodel? My last thought was that I could have 3 different chart controls and just hide and show them as appropriate. What is the CORRECT/SUGGESTED way to do this in the MVVM pattern? Any code examples would be greatly appreciated. Thanks

    Read the article

  • How to implement two way binding between an ActiveX control and a WPF MVVM View Model

    - by Zamboni
    I have a WPF application implemented using the MVVM framework that uses an ActiveX control and I need to keep the WPF and ActiveX UI synchronised. So far I can update the ActiveX UI when I change the WPF UI using the code at the bottom of the question that I got from the article Hosting an ActiveX Control in WPF and this question. But I cannot update the WPF UI when I make a change in the ActiveX UI. I suspect that I need to fire the PropertyChanged event from my ActiveX control but I have no idea how to do this or if it is even possible. The ActiveX controls I have written are in VB6 and MFC as I am just prototying at this time for the eventual integration of VB6 ActiveX controls in a WPF contaner application. Here is a code snipet that indicates the work done so far: System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); // Create the ActiveX control. AxTEXTBOXActiveXLib.AxTEXTBOXActiveX axWmp = new AxTEXTBOXActiveXLib.AxTEXTBOXActiveX(); // Assign the ActiveX control as the host control's child. host.Child = axWmp; axWmp.DataBindings.Add(new System.Windows.Forms.Binding("ActiveXStatus", (MainWindowViewModel)this.DataContext, "ModelStatus", true, DataSourceUpdateMode.OnPropertyChanged )); // Add the interop host control to the Grid // control's collection of child controls. this.activexRow.Children.Add(host); How to implement two way binding between an ActiveX control and a WPF MVVM View Model?

    Read the article

  • MVVM: Thin ViewModels and Rich Models

    - by Dan Bryant
    I'm continuing to struggle with the MVVM pattern and, in attempting to create a practical design for a small/medium project, have run into a number of challenges. One of these challenges is figuring out how to get the benefits of decoupling with this pattern without creating a lot of repetitive, hard-to-maintain code. My current strategy has been to create 'rich' Model classes. They are fully aware that they will be consumed by an MVVM pattern and implement INotifyPropertyChanged, allow their collections to be observed and remain cognizant that they may always be under observation. My ViewModel classes tend to be thin, only exposing properties when data actually needs to be transformed, with the bulk of their code being RelayCommand handlers. Views happily bind to either ViewModels or Models directly, depending on whether any data transformation is required. I use AOP (via Postsharp) to ease the pain of INotifyPropertyChanged, making it easy to make all of my Model classes 'rich' in this way. Are there significant disadvantages to using this approach? Can I assume that the ViewModel and View are so tightly coupled that if I need new data transformation for the View, I can simply add it to the ViewModel as needed?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >