Search Results

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

Page 11/50 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • MVVM with animations (should I use VisualStateManager?)

    - by kennethkryger
    I've got a View.xaml with the following set in Resources-section: <DataTemplate DataType="{x:Type ViewModels:MyFirstViewModel}"> <Views:MyFirstView Content="{Binding}" /> </DataTemplate> <DataTemplate DataType="{x:Type ViewModels:MySecondViewModel}"> <Views:MySecondView Content="{Binding}"/> </DataTemplate> In the content of the View.xaml I have: <!-- SelectedMyViewModel is either set to MyFirstViewModel or MySecondViewModel --> <ContentControl Content="{Binding SelectedMyViewModel}" /> When the SelectedMyViewModel changes I'd like to have a animation, so that the current view is faded out and the new view is faded in... Somehow I feel this should be possible via the VisualStateManager - but I can't figure out how! This is a WPF 4.0 project...

    Read the article

  • Can't pass a single parameter to lambda function in MVVM Light Toolkit's RelayCommand

    - by Dave
    I don't know if there's a difference between Josh Smith's and Laurent Bugnion's implementations of RelayCommand or not, but everywhere I've looked, it sounds like the Execute portion of RelayCommand can take 0 or 1 parameters. I've only been able to get it to work with 0. When I try something like: public class Test { public RelayCommand MyCommand { get; set; } public Test() { MyCommand = new RelayCommand((param) => SomeFunc(param)); } private void SomeFunc( object param) { } } I get the error: Delegate 'System.Action' does not take '1' arguments. Just to make sure I am not insane, I went to the definition of RelayCommand to make sure I didn't have some rogue implementation in my solution somewhere, but sure enough, it was just Action, and not Action<. What on earth am I missing here?

    Read the article

  • Storing entity in XML, using MVVM to read/write in WPF Application

    - by Christian
    Say I've a class (model) called Instance with Properties DatbaseHostname, AccessManagerHostname, DatabaseUsername and DatabasePassword public class Instance { private string _DatabaseHostname; public string DatabaseHostname { get { return _DatabaseHostname; } set { _DatabaseHostname = value; } } private string _AccessManagerHostname; public string AccessManagerHostname { get { return _AccessManagerHostname; } set { _AccessManagerHostname = value; } } private string _DatabaseUsername; public string DatabaseUsername { get { return _DatabaseUsername; } set { _DatabaseUsername = value; } } private string _DatabasePassword; public string DatabasePassword { get { return _DatabasePassword; } set { _DatabasePassword = value; } } } I'm looking for a sample code to read/write this Model to XML (preferably linq2XML) = storing 1:n instances in XML. i can manage the the view and ViewModel part myself, although it would be nice if someone had a sample of that part too..

    Read the article

  • I've got a ComboBox that's giving me grief in WPF using the MVVM pattern

    - by Mike
    Here's my code: <ComboBox Grid.Column="1" Grid.Row="9" ItemsSource="{Binding Path=PriorityEntries}" SelectedItem="{Binding Path=Priority,Mode=TwoWay}"/> The comboBox is bound properly with PriorityEntries, and when i change the value of the comboBox the "set" of the bound property(Priority) is called setting it to what it needs to be. However, when i close the UserControl that this combobox resides, it calls the set property again with a value of null and then sets what the selectedItem was to null. Why is the comboBox being bound again when I close the usercontrol. I tried setting the mode to OneTime, but that won't reflect any changes...

    Read the article

  • Silverlight MVVM ListBoxItem IsSelected

    - by Lee
    I have a collection of ViewModels bound to a ListBox. I am trying to bind the IsSelected properties of each together. In WPF it works by setting the style: <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" /> </Style> This does not work in Silverlight. How can I accomplish this?

    Read the article

  • Following Domain Driven Design with MVVM/WPF

    - by msfanboy
    Hello, I have plain POCOs here and as INotifyPropertyChanged is a Interface for the Views need its implemented in the ViewModel not the Model. Now I want to show validation errors in the View beside every textbox the user typed in data. I do not want to implemented the IDataErrorInfo interface in my Models because lets assume I am not allowed to touch them as they come from another Service/Supplier. I do not want to put my IsCustomerFirstNameLenthValid Method into the Model because I could not have access to it or I just dont want to pollute my Models with interface`s having nothing to do there! How can I validate my naked POCO`s in the ViewModel and forward the results to the View by showing validation errors ?

    Read the article

  • MVVM-Light EventToCommand Behavior for CheckBox Checked/Unchecked in Silverlight

    - by George Durzi
    I would like to handle the Checked and Unchecked events of a Checkbox control and execute a command in my ViewModel. I wired up an EventTrigger for both the Checked and Unchecked events as follows: <CheckBox x:Name="chkIsExtendedHr" IsChecked="{Binding Schedule.Is24Hour, Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <GalaSoft_MvvmLight_Command:EventToCommand CommandParameter="{Binding IsChecked, ElementName=chkIsExtendedHr}" Command="{Binding Path=SetCloseTime, Mode=OneWay}" /> </i:EventTrigger> <i:EventTrigger EventName="Unchecked"> <GalaSoft_MvvmLight_Command:EventToCommand CommandParameter="{Binding IsChecked, ElementName=chkIsExtendedHr}" Command="{Binding Path=SetCloseTime, Mode=OneWay}" /> </i:EventTrigger> </i:Interaction.Triggers> </CheckBox> I defined a RelayCommand in my ViewModel and wired up an action for it: public RelayCommand<Boolean> SetCloseTime{ get; private set; } ... SetCloseTime= new RelayCommand<bool>(ExecuteSetCloseTime); The parameter in the action for the command always resolves to the previous state of the CheckBox, e.g. false when the CheckBox is checked, and true when the CheckBox is unchecked. void ExecuteSetCloseTime(bool isChecked) { if (isChecked) { // do something } } Is this expected behavior? I have a workaround where I have separate triggers (and commands) for the Checked and Unchecked and use a RelayCommand instead of RelayCommand<bool>. Each command executes correctly when the CheckBox is checked and unchecked. Feels a little dirty though - even dirtier than having UI code in my ViewModel :) Thanks

    Read the article

  • Bi-directional view model syncing with "live" collections and properties (MVVM)

    - by Schneider
    I am getting my knickers in a twist recently about View Models (VM). Just like this guy I have come to the conclusion that the collections I need to expose on my VM typically contain a different type to the collections exposed on my business objects. Hence there must be a bi-directional mapping or transformation between these two types. (Just to complicate things, on my project this data is "Live" such that as soon as you change a property it gets transmitted to other computers) I can just about cope with that concept, using a framework like Truss, although I suspect there will be a nasty surprise somewhere within. Not only must objects be transformed but a synchronization between these two collections is required. (Just to complicate things I can think of cases where the VM collection might be a subset or union of business object collections, not simply a 1:1 synchronization). I can see how to do a one-way "live" sync, using a replicating ObservableCollection or something like CLINQ. The problem then becomes: What is the best way to create/delete items? Bi-directinal sync does not seem to be on the cards - I have found no such examples, and the only class that supports anything remotely like that is the ListCollectionView. Would bi-directional sync even be a sensible way to add back into the business object collection? All the samples I have seen never seem to tackle anything this "complex". So my question is: How do you solve this? Is there some technique to update the model collections from the VM? What is the best general approach to this?

    Read the article

  • Data binding manually update in WPF MVVM

    - by Benny
    My ViewModel: class ViewModel { public string FileName {get;set;} } and in my View I bind a label's content to ViewModel's FileName. now When I do drag-drop a file to my View, How can I update the label's Content property, so that the ViewMode's FileName also get updated via binding? Directly set the label's Content property won't work, it just simply clear the binding.

    Read the article

  • MVVM-Light Loaded Evented Executing Twice

    - by user275561
    Let me show the code first, The Control <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Controls:MatrixGrid x:Name="matrixGrid"> <i:Interaction.Triggers> <i:EventTrigger EventName="Loaded"> <cmd:EventToCommand Command="{Binding MatrixLoaded}" CommandParameter="{Binding ElementName=matrixGrid}" /> </i:EventTrigger> </i:Interaction.Triggers> </Controls:MatrixGrid> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> In The ViewModel Class I have public RelayCommand<MatrixGrid> MatrixLoaded { get; private set; } In The Constructor of the View Model I have MatrixLoaded = new RelayCommand<MatrixGrid>(MatrixGridAction); Now When I put a Breakpoint on the Function MatrixGridAction, The breakpoint is hit twice. Am I doing something wrong or is this a bug?

    Read the article

  • Refreshing Read-Only (Chained) Property in MVVM

    - by Wonko the Sane
    I'm thinking this should be easy, but I can't seem to figure this out. Take these properties from an example ViewModel (ObservableViewModel implements INotifyPropertyChanged): class NameViewModel : ObservableViewModel { Boolean mShowFullName = false; string mFirstName = "Wonko"; string mLastName = "DeSane"; private readonly DelegateCommand mToggleName; public NameViewModel() { mToggleName = new DelegateCommand(() => ShowFullName = !mShowFullName); } public ICommand ToggleNameCommand { get { return mToggleName; } } public Boolean ShowFullName { get { return mShowFullName; } set { SetPropertyValue("ShowFullName", ref mShowFullName, value); } } public string Name { get { return (mShowFullName ? this.FullName : this.Initials); } } public string FullName { get { return mFirstName + " " + mLastName; } } public string Initials { get { return mFirstName.Substring(0, 1) + "." + mLastName.Substring(0, 1) + "."; } } } The guts of such a [insert your adjective here] View using this ViewModel might look like: <TextBlock x:Name="txtName" Grid.Row="0" Text="{Binding Name}" /> <Button x:Name="btnToggleName" Command="{Binding ToggleNameCommand}" Content="Toggle Name" Grid.Row="1" /> The problem I am seeing is when the ToggleNameCommand is fired. The ShowFullName property is properly updated by the command, but the Name binding is never updated in the View. What am I missing? How can I force the binding to update? Do I need to implement the Name properties as DependencyProperties (and therefore derive from DependencyObject)? Seems a little heavyweight to me, and I'm hoping for a simpler solution. Thanks, wTs

    Read the article

  • WPF MVVM Property Change Animation

    - by cjibo
    I am looking for a clean way to start an animation that will have dynamic values. Basically I want to do an animation where an element changes width based on the data of another element. Say I have a TextBlock that's Text Property is Binding. When this property changes I want a visual element say a Rectangle for our sake to do a DoubleAnimation changing the width from previous value to the new value. I am trying to stay away from putting code in my view if possible. I've looked into DataTriggers but they seem to require that you know what the value would be such as an Enum. In my case it is just the value changing that needs to trigger a storyboard and the animation would need to start at the current(previous) value and move nicely to the new value. Any ideas. Maybe I just missed a property.

    Read the article

  • A view model mvvm design issue

    - by Chen Kinnrot
    the best way to explain is with example so: this is the model public class Person { public int age; public string name; } this is the view model public class PersonVM { } my question is: should the vm expose the person to the datga template or encapsulate the model properties with his own properties?

    Read the article

  • Simple Binding question, unable to bind to button command in a DataTemplate using MVVM Light Toolkit

    - by deliberative assembly
    I've been attempting to bind to buttons within a DataTemplate without much success. The button does not fire. Button Click works successfully outside of the DataTemplate. Yet if I create a Click="button_click" the click button is fired. The Button Content binds perfectly as well. Example to illustrate.. Why does the command not fire? Advice on how this should be handled this? The example is a simplified version of my real problem, I am currently not using a Listbox. I only recreated the same problem with a listbox..

    Read the article

  • C# - Silverlight - MVVM

    - by cmaduro
    I want to use UserControl as the base for my views, but I cannot add functionality to my views because they are based on UserControl. How do I create my own view class by using a subclassed version of UserControl.

    Read the article

  • drag-drop and data binding in MVVM

    - by Benny
    My ViewModel: class ViewModel { public string FileName {get;set;} } and in my View I bind a label's content to ViewModel's FileName. now When I do drag-drop a file to my View, How can I update the label's Content property, so that the ViewMode's FileName also get updated via binding? Directly set the label's Content property won't work, it just simply clear the binding.

    Read the article

  • MVVM and division of amongst multiple developers

    - by nlawalker
    Can anyone speak to the ease of dividing work amongst multiple developers when designing and building a medium- to large-complexity Silverlight or WPF application? My team is finding it difficult to cleanly split work when you've got, for example, a number of controls that provide different visualizations of a Model/ViewModel that's fairly complex and has a lot of properties and methods for interacting with data. It seems like a very big portion of the work ends up being the design and build of the Model/ViewModel, and much less inside each of the controls, which are naturally what are easy to ration out to multiple people.

    Read the article

  • MVVM and avoiding Monolithic God object

    - by bufferz
    I am in the completion stage of a large project that has several large components: image acquisition, image processing, data storage, factory I/O (automation project) and several others. Each of these components is reasonably independent, but for the project to run as a whole I need at least one instance of each component. Each component also has a ViewModel and View (WPF) for monitoring status and changing things. My question is the safest, most efficient, and most maintainable method of instantiating all of these objects, subscribing one class to an Event in another, and having a common ViewModel and View for all of this. Would it best if I have a class called God that has a private instance of all of these objects? I've done this in the past and regretted it. Or would it be better if God relied on Singleton instances of these objects to get the ball rolling. Alternatively, should Program.cs (or wherever Main(...) is) instantiate all of these components, and pass them to God as parameters and then let Him (snicker) and His ViewModel deal with the particulars of running this projects. Any other suggestions I would love to hear. Thank you!

    Read the article

  • Silverlight textblock binding question + MVVM

    - by AdrianDN
    Hello everyone, I'm trying to create a simple textblock control and I'm trying to insert a property from my ViewModel in the middle of the string. E.G. "Hello, My name is XX, bla, bla." (XX is a property from my ViewModel) <TextBlock Text="Hello, My name is {Binding SelectedUser.Name}, bla, bla." /> Is that possible? Regards, Adrian

    Read the article

  • Selecting the usercontrol to the relating datatemplate in mvvm

    - by msfanboy
    Hello, I have lets say a WeeklyViewUserControl.xaml and a DailyViewUserControl.xaml. Normally I used stuff like this to switch content: <DataTemplate DataType="{x:Type ViewModel:LessonPlannerViewModel}"> <View:LessonPlannerDailyUC/> </DataTemplate> This worked so far. But now I have still the WeeklyViewUC which uses 90 % of the LessonPlannerViewModel code so I want to make this additionally: <DataTemplate DataType="{x:Type ViewModel:LessonPlannerViewModel}"> <View:LessonPlannerWeeklyUC/> </DataTemplate> but this can not work, because from where does the ContentControl know that VM (LessonPlannerViewModel) should display a DailyViewUC or a WeeklyViewUC ? <ContentControl Content="{Binding VM}" />

    Read the article

  • WPF MVVM TreeView item source losing context after command

    - by user3955716
    I have a treeview which contains files, every view model holds an item source which is an ObservableCollection with files items: public ObservableCollection<CMItemFileNode> SubItemNode On each item i have context menu options (Delete, Execute..). If i move from one viewModel to another the ObservableCollection of files updated correctly and presented correctly but, when i perform a context menu command like delete file item, the command execute good but when i move to another view model (which holds SubItemNode ObservableCollection of is own) after the command executed the WPF still thinks i'm in the last view model i was in and not the one i'm really on. Very important to mention is that when i update to .net 4.5 (which unfortunantly i can't do) everything is ok and the ObservableCollection addresses the correct view model. Here is the treeView: <TreeView x:Name="Files" Margin="0,5,5,0" Grid.Row="6" Grid.Column="2" ItemsSource="{Binding SubItemNode}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" Height="300" Grid.RowSpan="6" Width="300" dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True" dd:DragDrop.DropHandler="{Binding}" dd:DragDrop.UseDefaultDragAdorner="True"> <TreeView.Resources> <Style TargetType="{x:Type TreeView}"> <Setter Property="local:CMTreeViewFilesBehavior.IsTreeViewFilesBehavior" Value="True"/> </Style> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected}" /> <Setter Property="local:CMTreeViewFilesItemBehavior.IsTreeViewFilesItemBehavior" Value="True"/> </Style> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /> </TreeView.Resources> <TreeView.ContextMenu> <ContextMenu> <MenuItem Header="View File" Command="{Binding ExecuteFileCommand}" /> <Separator /> <MenuItem Header="Delete all" Command="{Binding DeleteAllFilesCommand}" /> <MenuItem Header="Delete selected" Command="{Binding DeleteSelectedFilesCommand}" /> </ContextMenu> </TreeView.ContextMenu> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding SubItemNode}" > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Margin="2" Width="32" Height="18" Source="{Binding Path=Icon}" HorizontalAlignment="Left" VerticalAlignment="Center" /> <TextBlock Text="{Binding Path=Name}" Grid.Column="1" Margin="2" VerticalAlignment="Center" Foreground="{Binding Path=Status, Converter={StaticResource ItemFileStatusToColor}}" FontWeight="{Binding Path=IsSelected, Converter={StaticResource BoolToFontWidth}}"/> </Grid> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> Am I doing somthing wrong? and why in .net 4.5 it works well ?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >