I made a WPF application (Framework 4.5) on Windows 8 which uses usual comboboxes and some other controls. The problem I am facing is that it crashes on Windows 7:
A first chance exception of type System.Windows.Markup.XamlParseException occurred in PresentationFramework.dll
Additional information: 'Initialization of 'System.Windows.Controls.ComboBox' threw an exception.'
Here is my XAML for combobox:
<ComboBox Name="bloodGroupList" Grid.Row="7" Grid.Column="1"
SelectedIndex="{Binding Patient.BloodGroup, Converter={StaticResource StrToBlood}, Mode=TwoWay}"
IsEnabled="{Binding IsEditing}"
VerticalAlignment="Center" Margin="5,5.5" VerticalContentAlignment="Center"
BorderThickness="0" Height="22" TabIndex="4" HorizontalContentAlignment="Stretch">
<ComboBoxItem Content="A+" />
<ComboBoxItem Content="A-" />
<ComboBoxItem Content="B+" />
<ComboBoxItem Content="B-" />
<ComboBoxItem Content="O+" />
<ComboBoxItem Content="O-" />
<ComboBoxItem Content="AB+" />
<ComboBoxItem Content="AB-" />
</ComboBox>
I read on some blog to run this fix NDP45-KB2750147-x64
but it says:
Software Update KB2750147 Installation Wizard does not apply, or is blocked by another condition on your computer. Please click the link below for more details.
I put this in the App.xaml.cs
file to get the full stack trace. This might be a useful way for you to troubleshoot problems.
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Threading;
public partial class App : Application
{
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
// All unhandled exceptions come here. A stacktrace is saved as a text file with date and time.
StackTrace st = new StackTrace(e.Exception);
string fileName = DateTime.Now.ToString().Replace('/', '-').Replace(':', '-') + " errors.txt";
fileName = @"C:\Users\Public\" + fileName;
System.Windows.MessageBox.Show("Critical Error. Closing program.\nStacktrace can be found:" + fileName);
using (var stream = new FileStream(fileName, FileMode.OpenOrCreate))
{
using (var strWrite = new StreamWriter(stream))
{
strWrite.Write(st.ToString());
}
}
if (MainWindow != null)
{
MainWindow.Close();
}
else
{
Environment.Exit(0);
}
e.Handled = true;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.