mvvm-light

Pass Parameter for Dynamic Buttons - MVVM Light

南楼画角 提交于 2019-12-13 08:55:54
问题 The following code successfully creates two buttons dynamically, what I can not figure out is how to make the buttons open a different files when clicked. What am I missing? XAML: <ItemsControl ItemsSource="{Binding DataButtons}"> <ItemsControl.ItemTemplate> <DataTemplate> <Button Content="{Binding ButtonName}" Command="{Binding ButtonCommand}" CommandParameter="{Binding FilePath}"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> ViewModel: namespace DynamicControlsMvvmLight

Xamarin.Forms How to switch pages using MVVMLight

白昼怎懂夜的黑 提交于 2019-12-13 08:15:15
问题 I'm currently working on a Xamarin.forms project using .NET Standard as code sharing strategy. I try to use the MVVM pattern by using the MvvmLightLibsStd10 library. I already successfully setup the MVVM structure by using this tutorial: https://www.linkedin.com/pulse/build-xamarinforms-net-standard-mvvm-light-app-rafael-carvalho I can't use Navigation.PushAsync(new Page()); because it only works in code behind and not in the ViewModel. I already tried to Pass Navigation trough the VM

How to refresh a Telerik datagrid using UWP and MVVM Light

风流意气都作罢 提交于 2019-12-13 04:09:10
问题 Thanks for visiting. I am having trouble refreshing a Telerik grid when the Refresh button is clicked. In other words, if the user changes the data and decides not to save it, clicking the refresh button should reload the grid with the original values. Here is my XAML in the View for the Refresh: <Button Content="Refresh" Grid.Row="1" Margin="92,5,0,11" Command="{x:Bind ViewModel.RefreshDataCommand}"/> Here is my XAML in the View for the Grid: <tg:RadDataGrid ColumnDataOperationsMode="Flyout"

How to highlight dates in a TextBlock MVVM Light

风格不统一 提交于 2019-12-13 04:01:16
问题 I want to highlight the foreground or background color of the dates based on current date. How can I do it in my ViewModel? What are the codes I can use to highlight the date? Here are my codes for the whole project: xaml: <Grid Margin="10,102,10,298"> <GridView ItemsSource="{Binding Calendar.DateCollection}"> <GridView.ItemTemplate> <DataTemplate> <Grid x:Name="dateGrid" Background="AntiqueWhite" Width="50" Height="30"> <TextBlock x:Name="txtDate" Text="{Binding}" Foreground="Black"

Null reference error in App.xaml MVVM light

丶灬走出姿态 提交于 2019-12-13 02:16:33
问题 I'll make a WPF application whit one window and by changing the content of the Frame I'll navigate troth my application. For this I'm using MVVM light. But on App.xaml I've got this error in the error list of Visual Studio. Object reference not set to an instance of an object. Here is the code where the error happens: <Application x:Class="Project.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr

Disposing a timer inside a ViewModel, upon closing the main window

安稳与你 提交于 2019-12-13 01:25:51
问题 Currently in my application, I have a RelayCommand which calls an action which starts a Timer . I have a separate command which the calls the Dispose() method to get rid of/release the timer. This all sits in the ViewModel counterpart of the project. Using the MVVM pattern, how would I dispose of this Timer upon closing the window, as well as carrying out the regular/default operation of closing the window? I am also using the MVVM-Light toolkit, if this is of any help. An example of my

WCF service call and MVVM light toolkit trouble

坚强是说给别人听的谎言 提交于 2019-12-13 00:26:12
问题 I have build a WCF template service which talks (original: discuss) with my EF connected to my database. Then I have my main aplication which a simple WPF implementing MVVM light. My main application is referecing my WCF service and has created the config file automatically. In my ViewModel constructor I am calling my WCF service in order to get the collecton of data which will be bound to the view. Toruble is that doing that, the Datacontext which is initialised to the ViewModelLocator

How to have a blendable project using MVVM-Light and WCF RIA Services

↘锁芯ラ 提交于 2019-12-12 17:34:40
问题 I'd like to build my business application using the MVVM pattern. I choose MVVM-Light because it fits to my needs. In every example I've seen about MVVM-Light, no-one use the WCF RIA. The classic MIX10 example uses a Service in the same project while WCF RIA create a service in the Web project. The question is: it looks very hard to build an interface of the whole DomainContex the WCF Ria creates (it is surely hard for me!) but without an interface how could I build a fake DomainContex to be

WPF binding different UserControls in a DataTemplate of TabControl

限于喜欢 提交于 2019-12-12 17:20:19
问题 As a new in WPF and MVVM light, I am struggling to apply the MVVM pattern in a TabControl. I will give you an example of what I am trying to achieve. TabOne xaml and its view model <UserControl x:Class="TestTabControl.TabOne" xmlns:local="clr-namespace:TestTabControl" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <TextBlock Text="tab one ..." FontWeight="Bold" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </UserControl> //TabOne ViewModel

UWP InkCanvas Out Of Memory

痴心易碎 提交于 2019-12-12 17:13:04
问题 I'm using MVVMLight to create a questionnaire and running into memory issues when rendering the InkCanvas controls. Here's a watered down example of what I am working with: QuestionVm public Question Question { get; set; } public HandwritingControl HandwritingControl { get; set; } QuestionnaireVm public List<QuestionVm> currentQuestions; public List<QuestionVm> CurrentQuestions { get { return currentQuestions; } set { currentQuestions = value; RaisePropertyChanged(); } } Questionnaire.xaml.cs