I have a DataGrid with a couple of DataGridTemplateColumns.
When I try to hit the Enter-key on my keyboard there is no new row created in the DataGrid.
I have other DataGrids with columns which are not DataGridTemplateColumns and I can then create new rows by hitting the Enter-key. So I assume the DataGridTemplateColumns in some way causing the problem.
I have made a reproducible code and I have made it public in this GIT-Gist.
* I use Fody PropertyChanged to handle all the INotificationPropertyChanged in my view models.
* The code should just be copy-and-paste.
The bindings between the View and the ViewModels also don't seem to work :S
But if you uncomment the row in the ViewModel's construcotor (please see line 60 in the MainWindow.xaml.cs), a new row in the DataGrid will be created. With this row, the bindings works as expected. I cannot understand why.
Here is the XAML-code. It maybe enough for you with only the XAML-code to solve this problem.
The benefit of asking "clear questions" is that you might get an "answer", instead of another "question" asking you to clarify your question. You must have a lot of time on your hands to be able to deal with just more questions (and no answers).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
I have a Storyboard at Window resources as shown below.
The Storyboard can be started with the following string which is placed in regular Button.
I'm working on a custom installation wizard. From it, I'm calling DISM to install IIS and ASP.Net if they're not installed. All the code in the installer class works fine when called from a console app. I'm now trying to put a simple UI on it.
There are 2 steps. Each step raises the event 'CurrentTaskChanged' with text "Installing IIS" or "Installing ASP.Net", and then during installation it raises a ProgressChanged event to send progress to the UI.
The problem is that none of the UI updates happen until the after the entire install process finishes.
Installer Class Code
public static void Install()
private static void InstallIIS()
InstallFeature("IIS", "/Online /Enable-Feature /FeatureName:IIS-DefaultDocument /All");
private static void InstallASPDotNet()
InstallFeature("ASP.Net", "/Online /Enable-Feature /FeatureName:IIS-ASPNET45 /All");
private static void InstallFeature(string featureName, string args)
// Raise the task changed event so the UI shows what is installing
string dism = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "system32", "dism.exe");
if (Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess)
dism = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "sysnative", "dism.exe");
var process = new Process();
var startInfo = new ProcessStartInfo
UseShellExecute = false,
CreateNoWindow = false,
RedirectStandardOutput = true,
FileName = dism,
Arguments = args
process.StartInfo = startInfo;
process.OutputDataReceived += (sender, e) => HandleDISMOutput(e.Data);
process.StartInfo.Verb = "runas";
catch (Exception e)
private static void HandleDISMOutput(object data)
if (data != null)
var info = data.ToString();
// Parse out the percent digits
info = info.Replace('[', ' ');
info = info.Replace(']', ' ');
info = info.Replace('=', ' ');
info = info.Replace(" ", "");
info = info.Replace("%", "");
double.TryParse(info, out double percent);
// Raise the percent completed event to update the progress bar in the UI
Requires multi-select enabled in the data grid and one delete command per selected record.
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
I have a WPF project working fine in Windows 7, but which has a completely changed layout, when the same project is executed under Windows 10.
Do any of you have experiences with this issue?
I have found out that WPF loads the current theme/skin from the OS, and that this may be the cause of the skewed layout, but I haven't been able to find any whitepapers or guides with information on how to work around this problem.
It is a basic Grid with Stack Panels and Labels in it, if that helps.
Any help/ideas/links would be much appreciated
Kind regards - Jakob
Last Visit: 11-Jul-20 7:29 Last Update: 11-Jul-20 7:29