[Solved] Unable to Render ContentControl inside Window [closed]

Set the DataContext property of the window: <Window x:Class=”MimicView.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″ xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ xmlns:local=”clr-namespace:MimicView” mc:Ignorable=”d” d:DataContext=”{d:DesignInstance local:MainWindowViewModel}” Title=”MainWindow” Height=”350″ Width=”525″> <Window.Resources> <DataTemplate DataType=”{x:Type local:ViewModel1}”> <local:View1/> </DataTemplate> </Window.Resources> <Window.DataContext> <local:MainWindowViewModel /> </Window.DataContext> <Grid> <ContentControl Content=”{Binding viewModel1}”></ContentControl> </Grid> </Window> This only sets the design time DataContext: d:DataContext=”{d:DesignInstance local:MainWindowViewModel}” You should also set the actual DataContext property: <Window.DataContext> … Read more

[Solved] WPF MVVM pattern

Your question is a bit scattered. But I’ll try address what I think are your issues. You say in the code behind you have: this.DataContext = new CategoryViewModel(); But nothing else. First thing to do with checking why your button isn’t working would be to see what action it is performing. Your XAML states it’s … Read more

[Solved] How to make a Progress/Message Window where each line can be different font, size, color?

Found Alternate row color in Listbox and used Bind foreground of Textblock. Realized I needed to make a class to hold my string and color. Put that class in an ObservableCollection, and bind to the ObservableCollection. My new class: public class DisplayData { public string _string { get; set; } public System.Windows.Media.Brush _color { get; … Read more

[Solved] Enable MVVM object only if three other MVVM objects are already enable

you could use this: //Button B private bool _enableButtonB; public bool EnableButtonB { get { return _enableButtonB; } set { _enableButtonB = value; OnPropertyChanged(“EnableButtonB”); EnableButtonA=value; } } private bool _enableButtonC; public bool EnableButtonC { get { return _enableButtonC; } set { _enableButtonC = value; OnPropertyChanged(“EnableButtonC”); EnableButtonA=value; } } //Button D private bool _enableButtonD; public bool … Read more

[Solved] Full example or tutorial about how to get Context from data binding android [closed]

The best way to format date and time is with String formatting. For example, you can use this: <TextView android:text=”@{@string/dateFormat(user.birthday)}” …/> Where the dateFormat is a resource like this: <string name=”dateFormat”>%1$td/%1$tm/%1$tY</string> And the birthday is a long. You should look at the date formatter documentation for more formatting information related to time and date. In … Read more

[Solved] How can I use combobox with wpf mvvm

Your code in LocationFilter make no sense at all. ParticularEntries.Select(pg => pg.Region.Location == _selectedLocation); It returns an IEnumerable<bool> but it is never assigned. If you want to filter, you have to use Where. But even if you change your code to ParticularEntries = ParticularEntries.Where(pg => pg.Region.Location == _selectedLocation); you will see a change, but you … Read more