mvvm

Image with Overlay ItemsControl

烈酒焚心 提交于 2021-01-29 03:30:27
问题 I found a example and it works well, if I remove the ScrollViewer , but I need the image inside of the ScrollViewer . The TextBox shall be a overlay of the image. In this example the image is not inside the ScrollViewer . Could somebody please advise how I go about adding the image inside? <Image Grid.Column="2" HorizontalAlignment="Center" Source="/Images/Italien.png" Stretch="None"/> <ScrollViewer Grid.Column="2" Margin="2,2,2,2" HorizontalScrollBarVisibility="Visible"

App.Current.MainPage NullReferenceException in Constructor of MainPageModel

空扰寡人 提交于 2021-01-29 02:30:01
问题 On the loading of MainPage , I am pushing another page from Constructor of MainPageModel . It throws NullReferenceException in MainPageModel . This is my code MainPage constructor public MainPage() { InitializeComponent(); Title = "MainPage"; BindingContext = new MainPageViewModel(); } MainPageModel constructor public MainPageViewModel() { App.Current.MainPage.Navigation.PushAsync(new HomePage()); //Exception //CommandMenu1 = new Command(async () => await NavigateNext()); } How can I solve

App.Current.MainPage NullReferenceException in Constructor of MainPageModel

给你一囗甜甜゛ 提交于 2021-01-29 02:23:54
问题 On the loading of MainPage , I am pushing another page from Constructor of MainPageModel . It throws NullReferenceException in MainPageModel . This is my code MainPage constructor public MainPage() { InitializeComponent(); Title = "MainPage"; BindingContext = new MainPageViewModel(); } MainPageModel constructor public MainPageViewModel() { App.Current.MainPage.Navigation.PushAsync(new HomePage()); //Exception //CommandMenu1 = new Command(async () => await NavigateNext()); } How can I solve

How to bind Windows Form Control to a “Grid” Panel using MVVM in WPF

﹥>﹥吖頭↗ 提交于 2021-01-28 11:20:57
问题 I am attempting to use MVVM to Bind a Windows Form Control to a panel in WPF. My overall objective is to be able to dynamically change which specific Windows Form Control I will use as I plan on having potentially several available. Right now, I have been able to get this to work by having the application launch a callback on initialization which accesses the grid object by name. Here is how XAML currently looks: <Grid Name="WindowsControlObject"></Grid> The Callback looks like the following:

load URL into WebBrowser with MVVM

二次信任 提交于 2021-01-28 04:57:16
问题 I'm makeing an app where you have a listbox in the buttom with a logo of different websites, and a WebBrowser on the top. The idea is that when you press on a logo, the webBrowser load the corresponding page. I already make this work, but I want to remake the app with MVVM to make it better. I've made the listbox with all the logos, but I dont know how to load the URL onto the WebBrowser when I click on the logo. 回答1: Not 100% sure if this will work on Phone7 but worth a shot... Fist off the

Binding to a property in another namespace?

穿精又带淫゛_ 提交于 2021-01-28 04:31:00
问题 I've got a style setter in a themes xaml file. I'm trying to bind the value of the Setter to a bool peoperty in a view model. I've got the namespace to the view model in themes: xmlns:propertyGrid="clr-namespace:MY.App.Controls.PropertyGrid;assembly=MY.APP.Controls" and the binding in the style: <Setter Property="IsExpanded" Value="{Binding Source={StaticResource propertyGrid:PropertyGridViewModel}, Path=AreCategoriesAutoExpanded}"/> Finally in the viewmodel I just have an auto property:

Binding to a property in another namespace?

梦想的初衷 提交于 2021-01-28 04:28:53
问题 I've got a style setter in a themes xaml file. I'm trying to bind the value of the Setter to a bool peoperty in a view model. I've got the namespace to the view model in themes: xmlns:propertyGrid="clr-namespace:MY.App.Controls.PropertyGrid;assembly=MY.APP.Controls" and the binding in the style: <Setter Property="IsExpanded" Value="{Binding Source={StaticResource propertyGrid:PropertyGridViewModel}, Path=AreCategoriesAutoExpanded}"/> Finally in the viewmodel I just have an auto property:

System.StackOverflowException WPF MVVM

北城余情 提交于 2021-01-28 04:09:46
问题 I am trying to create a simple digital clock in WPF using MVVM. I have a label which has a binding. The code behind is simple simple and raising a property changed event each second and I have a stackoverflow exception. Can someone please help ? public partial class MainWindow : Window, INotifyPropertyChanged { public MainWindow() { InitializeComponent(); this.DataContext = this; } private string _lblValue; public string LabelValue { get { UpdateLabel(); return _lblValue; } set { _lblValue =

MVVM add elements dynamically to scrollview

梦想的初衷 提交于 2021-01-27 19:55:20
问题 Apologies ahead of time if this was asked before. The closest thing I found was (How to use vertical Scroll view to show binding data), which looks promising, though I am not sure if it will work because my understanding is that a template, as the name and definition would imply, has to follow a specific pattern and thus can't be dynamic. My issue : I am trying to rewrite some of our code to more closely follow MVVM patterns, this of course means making the view as dumb as possible. In my

MVVM architecture in android Using Volley

我们两清 提交于 2021-01-27 19:50:18
问题 I'm studying the MVVM to see if it can help me for my upcoming projects. What I understand so far, is that I need to use a ViewModel for holding my UI datas. I also need to use a Repository class to perform all my Requests to WebServices, and I'm using the Volley Library. So here's what I did : The ViewModel public class MyViewModel extends ViewModel { private MyRepository repository; private MutableLiveData<MyPojo> pojo; public MyViewModel(MyRepository repository) { this.repository =