mvvm

Xamarin Forms MVVM (Prism) with Media.Plugin - How to get a taken picture from device storage

流过昼夜 提交于 2021-01-27 18:34:47
问题 I am using Xamarin Forms PCL (MVVM Prism) with MediaPlugin (https://github.com/jamesmontemagno/MediaPlugin). I have a viewModel with a public property called ImagePath private string imagePath; public string ImagePath { get { return imagePath; } set { SetProperty(ref imagePath, value, "ImagePath"); } } in my XAML i have: <Image Source="{Binding ImagePath}" HeightRequest="100" WidthRequest="100"/> When i set a image url (from web) to ImagePath property, it works without problems. (I am setting

WPF UserControl.Loaded event does not trigger

扶醉桌前 提交于 2021-01-27 18:33:28
问题 In my program, when I hover over (MouseEnter event) a certain UserControl (here I use TransportOrderLineUserControl) a TransportOrderLineDetailView should be shown. The TransportOrderLineDetailView should be placed at the bottom right of my screen. For this I need to know the ActualWidth & ActualHeight for a correct placement. Because those 2 properties need to have a value different than 0 I execute this code with the DetailView.Loaded event. I use the exact same way for two other objects.

Best practices for Xamarin.Mac MVVM pattern

六月ゝ 毕业季﹏ 提交于 2021-01-27 12:52:11
问题 I'm developing a WPF desktop application that I'd also like to run on Mac via Xamarin.Mac. I've taken great care to separate as much core code as possible into a PCL, and keep the WPF-specific code as thin as possible. The UI architecture is MVVM. All of my viewmodels, implementing INotifyPropertyChanged , in are in my core PCL. The WPF UI components can then directly bind to those viewmodel properties. My question is: how can I use my "portable" PCL viewmodels from the Xamarin.Mac side so

Populate a DataGrid using ViewModel via a database

被刻印的时光 ゝ 提交于 2021-01-27 12:51:01
问题 Basically, I have a 4 files that I'm dealing with: DBDisplay.xaml DBDisplay.xaml.cs DBDisplayViewModel.cs DBConn.cs In my ViewModel I am trying to populate the following DataGrid from my .xaml file: <DataGrid ItemsSource="{Binding Path=Users}"/> With the following code: public class DBDisplayViewModel { public ICollectionView Users { get; set; } DBConn dbCon; // the connection object DataSet dataSet; DataRow dataRow; private void Load() { string connectionString = Properties.Settings.Default

How to share view models between fragments using Google's GithubBrowserSample approach?

a 夏天 提交于 2021-01-27 12:08:01
问题 I am very new using Android architecture components, so I decided to base my application using GithubBrowserSample to achieve many of my use cases. But i have the problem that i don´t know what is the correct way to share viewmodels between fragments with this approach. I want to share the view model because i have a fragment with a viewpager with 2 fragments that need to observe data of the parent fragment view model I used this before to achieve it, based on google's documentation override

How does this button click work in WPF MVVM?

回眸只為那壹抹淺笑 提交于 2021-01-27 09:05:50
问题 I'm starting to study about WFM MVVM pattern. But I can't understand why this Button click works without binding any event or action. View <Window x:Class="WPF2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:WPF2.ViewModel" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <vm:MainWindowViewModel x:Key="MainViewModel" /> </Window.Resources> <Grid x:Name="LayoutRoot"

How does this button click work in WPF MVVM?

扶醉桌前 提交于 2021-01-27 09:05:34
问题 I'm starting to study about WFM MVVM pattern. But I can't understand why this Button click works without binding any event or action. View <Window x:Class="WPF2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:WPF2.ViewModel" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <vm:MainWindowViewModel x:Key="MainViewModel" /> </Window.Resources> <Grid x:Name="LayoutRoot"

How does this button click work in WPF MVVM?

旧街凉风 提交于 2021-01-27 09:04:31
问题 I'm starting to study about WFM MVVM pattern. But I can't understand why this Button click works without binding any event or action. View <Window x:Class="WPF2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:WPF2.ViewModel" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <vm:MainWindowViewModel x:Key="MainViewModel" /> </Window.Resources> <Grid x:Name="LayoutRoot"

WPF MVVM ContextMenu binding IsOpen to Model

北城余情 提交于 2021-01-27 05:34:00
问题 I have a button with a context menu associated to it. I can right click on the button and show the context menu as you would expect, however I want to be able to show the context menu after another event, such as a left click, or a drag and drop style event. I am attempting to do this by binding the IsOpen property of the context menu to the view model, but this is not working as expected. On first left click of the button, nothing happens, although I can see the property on the view model

Pass KeyUp as parameter WPF Command Binding Text Box

感情迁移 提交于 2021-01-27 04:50:50
问题 I've a Text box KeyUp Event Trigger Wired up to a command in WPF. I need to pass the actual key that was pressed as a command parameter. The command executes fine, but the code that handles it needs to know the actual key that was pressed (remember this could be an enter key or anything not just a letter, so I can't get it from the TextBox.text). Can't figure out how to do this. XAML: xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" XAML: <TextBox