I have a xaml file looking like this.
<Window x:Class="Space4it.Energilab.DataApplicationWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:Space4it.Energilab.DataApplicationWPF"
Title="Space4it NetBitter database interface" Height="700" Width="1200"
x:Name="rootElement"
Icon="program.ico">
<Window.DataContext>
<local:MainWindowDataModel/></Window.DataContext>
The MainWindowDataModel are located in the main WPF project and it works in “Debug – X86”.
But when changing to “Production – X64” I get this error:
Error 1 The name “MainWindowDataModel” does not exist in the namespace “clr-namespace:Space4it.Energilab.DataApplicationWPF”. C:\Users\tarp\Dropbox\Space4it\Development\Energilab\Development\Space4it.Energilab.Solution\Space4it.Energilab.DataApplicationWPF\MainWindow.xaml 10 5 Space4it.Energilab.DataApplicationWPF
I did “Clean”, recompile ….
Funny thing is that the DataGrid fetches data, but this ComboBox inside grid does not! This is only a problem when installing program om other computer. I.e. Windows Server 2008.
<DataGridComboBoxColumn Header="Key" SelectedValueBinding="{Binding Path=t_keys_id, UpdateSourceTrigger=PropertyChanged}">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding ElementName=rootElement, Path=DataContext.keyData}"/>
<Setter Property="IsEditable" Value="False"/>
<Setter Property="DisplayMemberPath" Value="nb_key" />
<Setter Property="SelectedValuePath" Value="id"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding ElementName=rootElement, Path=DataContext.keyData}"/>
<Setter Property="IsEditable" Value="True"/>
<Setter Property="DisplayMemberPath" Value="nb_key" />
<Setter Property="SelectedValuePath" Value="id"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
Does anyone have any ideas?
At a guess, I’d say that the Space4it.Energilab.DataApplicationWPF assembly had been compiled with the “x86” platform, instead of “AnyCPU” or “x64″…so when you switch the configuration it can’t access a 64bit version of that assembly.
If it’s a 3rd party library whose source you don’t have then you might be able to hack it with CorFlags to allow it to be JITted as 64bit (by clearing the 32bit flag).
http://msdn.microsoft.com/en-us/library/ms164699(v=vs.80).aspx
http://tipila.com/tips/53/how-to-check-if-a-dll-is-32-bit-or-64-bit
If you do have the source, then you can build it so it can be used in 64bit mode take a look at the Configuration Manager in your Solution, and check which Platform configuration is used for the project in “Production – x64”