fs_tigre fs_tigre - 6 months ago 36
C# Question

MVVM Light namespace issue - Code compiles fine but no preview of the controls in the XAML file

Any idea what's wrong with the following (MVVM Light) code. It compiles fine but for some reason I cannot see a preview of the controls and I see a squiggly line in the EventToCommand (

<GalaSoft_MvvmLight_Command:EventToCommand
see picture below) but it seems to have the right namespace.

Any idea how can I fix it? Or this is simply the behavior expected when using MVVM Light?

FYI - Found a few similar questions about namespacing issues but my seem to be different since the code compiles fine.

<Window x:Class="MvvmControlChange.Content.MainPage.View.MainPageView"
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:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ignore="http://www.ignore.com"
mc:Ignorable="d ignore"
DataContext="{Binding MainPageViewModel,
Source={StaticResource Locator}}"
Title="Give me Liberty or Give me Smart Basic"
d:DesignHeight="360"
d:DesignWidth="488"
SizeToContent="WidthAndHeight">


<Button x:Name="Page2Button"
Content="Page 2"
Margin="0"
Grid.Row="1"
d:LayoutOverrides="Width, Height"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Custom:Interaction.Triggers>
<Custom:EventTrigger EventName="Click">
<GalaSoft_MvvmLight_Command:EventToCommand x:Name="Page2ButtonClicked"Command="{Binding Page2Command, Mode=OneWay}" />
</Custom:EventTrigger>
</Custom:Interaction.Triggers>
</Button>

</Window>


Squiggly Line:
enter image description here

Reference Files:

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download