Search Results

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

Page 27/50 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • A viewmodel's role beyond databinding?

    - by DeanMc
    I'm a bit confused as to what a viewmodel's role is beyond databinding. I have a menu built in silverlight. The menu has x number of menu items which is determined at runtime. One of the features I would like to add to this is that each menuitem has a different text colour when hovered over. Is it the role of the view to have a colour selector method or should the view handle this in it's code behind?

    Read the article

  • Caliburn.micro View ViewModel name resolution issue

    - by user1459773
    I am using a namespace called ComShorCaliburnWPF.ViewModules.Views.ShortMenuWindows.GWDSCT on my View.xaml and View.cs, for my ViewModel.cs and my IoC container I am using ComShorCaliburnWPF.ViewModules.Views.ShortMenuWindows.GWDSCT. When I remove the GWDSCT at the end it works fine, but in its current state it does not. I would like it to work how it is now because it accurately reflects where the files are located. Any suggestions?

    Read the article

  • RelayCommands overriding the "IsEnabled" of my buttons.

    - by vidalsasoon
    RelayCommands overriding the "IsEnabled" of my buttons. Is this is a bug? Here is xaml from my View and code from my ViewModel <Button Grid.Column="0" Content="Clear" IsEnabled="False" cmd:ButtonBaseExtensions.Command="{Binding ClearCommand}" /> public RelayCommand ClearCommand { get { return new RelayCommand(() => MessageBox.Show("Clear Command")); } } Notice I hardcoded the IsEnabled="False" in my xaml. This value is completely ignored (button always enabled). I realize that RelayCommand have a CanExecute overload but I did want to use this as I want to do more than just have a disabled button.

    Read the article

  • Bind event in custom WPF control to command in ViewModel

    - by Jon Archway
    Hi, I have a custom control that has an event. I have a window using that custom control. The window is bound to a viewmodel. I would like to have the event from the custom control direct to an ICommand on my viewmodel. I am obviously being dense here as I can't figure out how to do this. Any assistance is most welcome. Thanks

    Read the article

  • How can I incorporate a data bound list of MenuItems to another MenuItem in WPF?

    - by Julien Poulin
    I have a 'File' MenuItem were I would like to display a list of recently opened files. Here is the xaml I have now: <MenuItem Header="File}"> <MenuItem Header="Preferences..." Command="{Binding ShowOptionsViewCommand}" /> <Separator /> <ItemsControl ItemsSource="{Binding RecentFiles}"> <ItemsControl.ItemTemplate> <DataTemplate> <MenuItem Header="{Binding DisplayPath}" CommandParameter="{Binding}" Command="{Binding Path=DataContext.OpenRecentFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"> </MenuItem> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <Separator /> <MenuItem Header="Exit" Command="{Binding CloseCommand}" /> </MenuItem> However, when I use this code, there is a weird offset around the MenuItems and it looks like there is a container around them. How can I get rid of that? Here is a screenshot of what it looks like:

    Read the article

  • Passing Services to MainViewModel - SHOULD I use a dependency injection container ?

    - by msfanboy
    Hello, I have this code: public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var mainVM = new MainViewModel ( new Service1(), ... new Service10(), ); var window = new MainWindow(); window.DataContext = mainVM; window.Show(); } } I pass all my Services instances to the MainViewModel. Within the MainViewModel I spread those services to other ViewModels via constructor parameter passing. Should I use any DI framework for the services in the App class? If yes whats the benefit of resolving the services instead of just creating the instance manually... ?

    Read the article

  • How to bind Listbox to two properties?

    - by Gabriel
    I have in Silverlight a Grid with DataContext set to class ViewModel. ViewModel contains list of items (each of them containing int ID and string Text) and an integer "ID", which identifies actually active item (not selected item). I would like to construct xaml with ListBox where activated item has another color. How can I do it?

    Read the article

  • Silverlight and M-V-VM - Where should a timer live?

    - by Bill Jeeves
    I'm creating a simple monitoring tool in Silverlight. It talks to a web service to retrieve the status information and store it in the ViewModel. This needs to happen once per minute so I'm going to add a timer for this purpose (probably a DispatcherTimer). My question is, where should the timer go in an M-V-VM architecture? In the ViewModel or the View?

    Read the article

  • Parent and child model interaction

    - by jminarik
    Hi, is it possible set something like wpf window owner in caliburn.micro ? I have PARENT VIEW MODEL, from this model I open CHILD SCREEN {VIEW MODEL} with this method: public IEnumerable<IResult> Open() { yield return new ShowWindow("ChatScreen") .InitializeWith(_service .DetailData(Account, _selectedFriend.Value.Nick), AvatarImage); } This method create a new WPF WINDOW - CHILD SCREEN and initialize CHILD VIEW MODEL with some variables. I would like set something like this CHILD_SCREEN.PARENT = PARENT_VIEW_MODEL. I would like achieve if I close PARENT VIEW MODEL that it close also all CHILD MODELS. Also it exist way how can I check if screen, in my situation WPF window, is active/inactive from MAIN VIEW MODEL?

    Read the article

  • Silverlight and MV(VM) Pattern - No Code-Behind - Is this possible?

    - by user118190
    I am working on Silverlight 3.0 and currently using code-behind in my Views. I would like to implement the MV(VM) pattern into my project as the project is growing. I have seen some WPF projects where the code-behind has NO CODE except for the InitializeComponent method, which I believe is the right way to go and just looks clean. Is this possible in Silverlight 3.0, that is, no code-behind? Can anyone point me to some good Silverlight (3.0) MV(VM) tutorials / articles?

    Read the article

  • Handling exceptions in Prism 4 modules

    - by marcellscarlett
    I've gone through a number of threads here about this topic with no success. It seems that in the App.xaml.cs of our WPF application, handling DispatcherUnhandledExceptions and AppDomain.CurrentDomain.UnhandledException don't catch everything. In this specific instance we have 7 prism modules. My exception handling code is below (almost identical for UnhandledException): private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { try { var ex = e.Exception.InnerException ?? e.Exception; var logManager = new LogManager(); logManager.Error(ex); if (!EventLog.SourceExists(ex.Source)) EventLog.CreateEventSource(ex.Source, "AppName"); EventLog.WriteEntry(ex.Source, ex.InnerException.ToString()); var emb = new ExceptionMessageBox(ex); emb.ShowDialog(); e.Handled = true; } catch (Exception) { } } The problem seems to be the unhandled exceptions occurring in the modules. They aren't caught by the code above and they cause the application to crash without logging or displaying any sort of message. Does anyone have experience with this?

    Read the article

  • Should I use ObservableCollections in my Model in M-V-VM

    - by Bill Jeeves
    I'm completely new to M-V-VM and very new to Silverlight, just reading about it for the first time today. As a sample, I am creating a model containing a list of items. My (Silverlight 4) View contains a listbox and my ViewModel will look to the model to retrieve the collection that the listbox will bind to. My question is this. I think it would be good to use an ObservableCollection to hold the items that the listbox binds to. This would be an ObseravleCollection in the ViewModel. Should I also use this type of collection in the model, or should I use another collection type and do smoe conversion between model and viewmodel?

    Read the article

  • How do I link (dependency) properties in my ViewModel?

    - by mos
    Simplified example: I have an object that models a user. Users have a first name and a last name. The UserViewModel has a dependency property for my Models.User object. In the declaration of the UserView's xaml, I want to bind a couple of TextBlocks to the first and last name properties. What is the correct way to do this? Should I have readonly DependencyProperties for the name fields, and when the dependency property User is set, update them? Can the name fields be regular C# properties instead? Or, should I bind like this: <TextBlock Text="{Binding User.FirstName}" />

    Read the article

  • I can not navigate to the next page in windows phone 7

    - by Vijay
    I am trying to navigate form one page to another page depends upon the login. If already user logged in, Welcome page should open. Else Log in Page should open. I am trying like this. The Splash Page is the start up page. This is a Splash Screen Xaml.cs: namespace NewExample.Views { public partial class SplashPage : PhoneApplicationPage { public SplashPage() { InitializeComponent(); this.DataContext = new SplashPageViewModel(); } } } This is Splash Screen View Model: Here I am check the user already logged in or not. namespace NewExample.ViewModel { public class SplashPageViewModel { public static bool isLogin = false; public SplashPageViewModel() { var rootFrame = (App.Current as App).RootFrame; if (isLogin) rootFrame.Navigate(new Uri("/Views/WelcomePage.xaml", UriKind.Relative)); else rootFrame.Navigate(new Uri("/Views/LoginPage.xaml", UriKind.Relative)); } } } But it is not working. The Splash Page only showing. This is not navigating to another page. Please help me to resolve this problem.

    Read the article

  • WPF/C# - Sometimes my dropdowns/datepickers will stop functioning?

    - by BlargINC
    Q: Where should I check to track this down? Issue: Opening a view model in my application sometimes makes dropdowns/datepickers nonfunctional. ie. dropdown won't drop and the datepicker calendar won't come up I suspect a binding issue but don't see one. Dropdowns have normal things like strings, numbers. One drop has a list of mini views. Datepickers are bound to nullable dates set in the constructor of the viewmodel. Note: These same things work in other viewmodels/views. I can paste code, I'm just not sure what code is relevant here. Thank you for helping me :)

    Read the article

  • Sometimes my dropdowns/datepickers will stop functioning?

    - by BlargINC
    Q: Where should I check to track this down? Issue: Opening a view model in my application sometimes makes dropdowns/datepickers nonfunctional. ie. dropdown won't drop and the datepicker calendar won't come up I suspect a binding issue but don't see one. Dropdowns have normal things like strings, numbers. One drop has a list of mini views. Datepickers are bound to nullable dates set in the constructor of the viewmodel. Note: These same things work in other viewmodels/views. I can paste code, I'm just not sure what code is relevant here.

    Read the article

  • Data-binding taking too long to update

    - by Justin
    In my application I have this code in my view model: hiddenTextContainer.PreHideVerticalOffset = VerticalOffset; hiddenTextContainer.HiddenText = Text.Remove(SelectionStart, SelectionLength); hiddenTextContainer.HasHiddenText = true; hiddenTextContainer.NonHiddenTextStart = SelectionStart; Text = Text.Substring(SelectionStart, SelectionLength); SelectionStart = Text.Length; hiddenTextContainer.ImmediatePostHideVerticalOffset = VerticalOffset; This code is used to hide selected text in a textbox. Text is a string property data bound to the text property of a textbox and VerticalOffset is a double property data bound to the VerticalOffset property of that same textbox. I need to save the VerticalOffset before and after the hiding of selected text takes place, but with my code below both hiddenTextContainer.PreHideVerticalOffset and hiddenTextContainer.ImmediatePostHideVerticalOffset are always set to the same value no matter what. I have figured out that this is because the text of the textbox has not been updated by the time the code reaches: hiddenTextContainer.ImmediatePostHideVerticalOffset = VerticalOffset; Is there any way I can fix this?

    Read the article

  • WPF Treeview contextmenu IsChecked binding MVVM

    - by BrettRobi
    I've got a TreeView to which I associate a ContextMenu. That contextmenu has an item whose IsChecked property I want to bind to my ViewModel. Since I am using a tree each treeitem is bound to a subproperty of my ViewModel. In the VS2010 output window I am seeing this databinding error: BindingExpression path error: 'IsAutoStart' property not found on 'object' ''HostMgmtViewModel' (HashCode=12565727)'. BindingExpression:Path=IsAutoStart; DataItem='HostMgmtViewModel' This clearly shows it is trying to bind to my ViewModel and not to the treeitem's associated data. How do I bind to the correct object? Remember my contextmenu is associated with the whole TreeView not to the specific treeitem.

    Read the article

  • Question on MVVM pattern on WPF ?

    - by Ashish Ashu
    I have a user control let say UC1 . This user control have viewmodel UC1_vm. In the usercontrol UC1 I have a canvas in which drawing curve logic is implemented. This drawing curve logic is based on the data points property in the view model ( UC1_vm). The data points property inside the view model change with different condition. The generation of data points is written in the View Model. I want to bind the data points property in the view model to the draw curve logic inside the User control (view). I want whenever the data point property is changed in the view model , the canvas calls the draw curve method. Can I set the set any property of canvas which when changed it calls the on paint logic auto matically? Please suggest me the approach of implementing this scenario!!

    Read the article

  • WPF/MVVM:Set multiple datacontext to ONE usercontrol

    - by msfanboy
    Hello, I have a UserControl with 5 small UserControl which are parts of the first UserControl. The first UserControl is datatemplated by a MainViewModel type. The other 5 small UserControls have also set the DataContext to this MainViewModel type. Now I want additionally that those 5 UserControls get a 2nd DataContext to access other public properties of another ViewModel . How can I do that?

    Read the article

  • wpf toolkit (Feb 2010) datagrid with MVVM - style reveals name of view model on 'spare column'

    - by Andy Clarke
    Hi, I've just updated my app with the latest WPF toolkit and I've now got an issue with my styling. When I bind some data with, for example, two columns to the grid, the spare area at the right shows the name of the ViewModel in the header. I can understand why, because the data grids data context is the ViewModel and I'm defining my header style as follows ... <WpfToolkit:DataGridHeaderBorder <Border BorderBrush="Blue" BorderThickness="0,1,0,0"> <TextBlock Text="{Binding}" Margin="4,0,4,0" /> </Border> </WpfToolkit:DataGridHeaderBorder> Do I now need a separate style for the 'spare column' or something? Can anyone assist please? Cheers, Andy

    Read the article

  • MVVM/WPF: DataTemplate is not changed in Wizard

    - by msfanboy
    Hello, I wonder why my contentcontrol(headeredcontentcontrol) does not change the datatemplates when I press the previous/next button. While debugging everything seems ok means I jump forth and back the collection of wizardpages but always the first page is shown and its header text not the usercontrol is visible. What do I have forgotten? using System; using System.Collections.Generic; using System.Linq; using System.Text; using GalaSoft.MvvmLight.Command; using System.Collections.ObjectModel; using System.Diagnostics; using System.ComponentModel; namespace TBM.ViewModel { public class WizardMainViewModel { WizardPageViewModelBase _currentPage; ReadOnlyCollection _pages; RelayCommand _moveNextCommand; RelayCommand _movePreviousCommand; public WizardMainViewModel() { this.CurrentPage = this.Pages[0]; } public RelayCommand MoveNextCommand { get { return _moveNextCommand ?? (_moveNextCommand = new RelayCommand(() => this.MoveToNextPage(), () => this.CanMoveToNextPage)); } } public RelayCommand MovePreviousCommand { get { return _movePreviousCommand ?? (_movePreviousCommand = new RelayCommand( () => this.MoveToPreviousPage(), () => this.CanMoveToPreviousPage)); } } bool CanMoveToPreviousPage { get { return 0 < this.CurrentPageIndex; } } bool CanMoveToNextPage { get { return this.CurrentPage != null && this.CurrentPage.IsValid(); } } void MoveToPreviousPage() { this.CurrentPage = this.Pages[this.CurrentPageIndex - 1]; } void MoveToNextPage() { if (this.CurrentPageIndex < this.Pages.Count - 1) this.CurrentPage = this.Pages[this.CurrentPageIndex + 1]; } /// <summary> /// Returns the page ViewModel that the user is currently viewing. /// </summary> public WizardPageViewModelBase CurrentPage { get { return _currentPage; } private set { if (value == _currentPage) return; if (_currentPage != null) _currentPage.IsCurrentPage = false; _currentPage = value; if (_currentPage != null) _currentPage.IsCurrentPage = true; this.OnPropertyChanged("CurrentPage"); this.OnPropertyChanged("IsOnLastPage"); } } public bool IsOnLastPage { get { return this.CurrentPageIndex == this.Pages.Count - 1; } } /// <summary> /// Returns a read-only collection of all page ViewModels. /// </summary> public ReadOnlyCollection<WizardPageViewModelBase> Pages { get { return _pages ?? CreatePages(); } } ReadOnlyCollection<WizardPageViewModelBase> CreatePages() { WizardPageViewModelBase welcomePage = new WizardWelcomePageViewModel(); WizardPageViewModelBase schoolclassPage = new WizardSchoolclassSubjectPageViewModel(); WizardPageViewModelBase lessonPage = new WizardLessonTimesPageViewModel(); WizardPageViewModelBase timetablePage = new WizardTimeTablePageViewModel(); WizardPageViewModelBase finishPage = new WizardFinishPageViewModel(); var pages = new List<WizardPageViewModelBase>(); pages.Add(welcomePage); pages.Add(schoolclassPage); pages.Add(lessonPage); pages.Add(timetablePage); pages.Add(finishPage); return _pages = new ReadOnlyCollection<WizardPageViewModelBase>(pages); } int CurrentPageIndex { get { if (this.CurrentPage == null) { Debug.Fail("Why is the current page null?"); return -1; } return this.Pages.IndexOf(this.CurrentPage); } } public event PropertyChangedEventHandler PropertyChanged; void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } } <UserControl x:Class="TBM.View.WizardMainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ViewModel="clr-namespace:TBM.ViewModel" xmlns:View="clr-namespace:TBM.View" mc:Ignorable="d" > <UserControl.Resources> <DataTemplate DataType="{x:Type ViewModel:WizardWelcomePageViewModel}"> <View:WizardWelcomePageView /> </DataTemplate> <DataTemplate DataType="{x:Type ViewModel:WizardSchoolclassSubjectPageViewModel}"> <View:WizardSchoolclassSubjectPageView /> </DataTemplate> <DataTemplate DataType="{x:Type ViewModel:WizardLessonTimesPageViewModel}"> <View:WizardLessonTimesPageView /> </DataTemplate> <DataTemplate DataType="{x:Type ViewModel:WizardTimeTablePageViewModel}"> <View:WizardTimeTablePageView /> </DataTemplate> <DataTemplate DataType="{x:Type ViewModel:WizardFinishPageViewModel}"> <View:WizardFinishPageView /> </DataTemplate> <!-- This Style inherits from the Button style seen above. --> <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}" x:Key="moveNextButtonStyle"> <Setter Property="Content" Value="Next" /> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsOnLastPage}" Value="True"> <Setter Property="Content" Value="Finish}" /> </DataTrigger> </Style.Triggers> </Style> <ViewModel:WizardMainViewModel x:Key="WizardMainViewModelID" /> </UserControl.Resources> <Grid DataContext="{Binding ., Source={StaticResource WizardMainViewModelID}}" > <Grid.RowDefinitions> <RowDefinition Height="310*" /> <RowDefinition Height="51*" /> </Grid.RowDefinitions> <!-- CONTENT --> <Grid Grid.Row="0" Background="LightGoldenrodYellow"> <HeaderedContentControl Content="{Binding CurrentPage}" Header="{Binding Path=CurrentPage.DisplayName}" /> </Grid> <!-- NAVIGATION BUTTONS --> <Grid Grid.Row="1" Background="Aquamarine"> <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> <Button Command="{Binding MovePreviousCommand}" Content="Previous" /> <Button Command="{Binding MoveNextCommand}" Style="{StaticResource moveNextButtonStyle}" Content="Next" /> <Button Command="{Binding CancelCommand}" Content="Cancel" /> </StackPanel> </Grid> </Grid>

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >