Click here to Skip to main content
14,451,668 members

Silverlight / WPF

AnswerRe: WPF C# Make window's the same width as the screen Pin
Richard Deeming3-Nov-19 23:28
communityengineerRichard Deeming3-Nov-19 23:28 
GeneralRe: WPF C# Make window's the same width as the screen Pin
Acuena4-Nov-19 13:31
MemberAcuena4-Nov-19 13:31 
GeneralRe: WPF C# Make window's the same width as the screen Pin
Mycroft Holmes4-Nov-19 19:42
MemberMycroft Holmes4-Nov-19 19:42 
GeneralRe: WPF C# Make window's the same width as the screen Pin
Gerry Schmitz5-Nov-19 6:25
mveGerry Schmitz5-Nov-19 6:25 
GeneralRe: WPF C# Make window's the same width as the screen Pin
Acuena8-Nov-19 6:21
MemberAcuena8-Nov-19 6:21 
GeneralRe: WPF C# Make window's the same width as the screen Pin
Richard Deeming8-Nov-19 7:14
communityengineerRichard Deeming8-Nov-19 7:14 
QuestionDataGrid with DataGridTemplateColumns - Cannot create new rows Pin
Mc_Topaz8-Oct-19 0:42
MemberMc_Topaz8-Oct-19 0:42 
AnswerRe: DataGrid with DataGridTemplateColumns - Cannot create new rows Pin
Gerry Schmitz8-Oct-19 4:11
mveGerry Schmitz8-Oct-19 4:11 
NewsRe: DataGrid with DataGridTemplateColumns - Cannot create new rows Pin
Mc_Topaz8-Oct-19 4:25
MemberMc_Topaz8-Oct-19 4:25 
QuestionWPF Pin
RajaMohammed.A3-Oct-19 23:29
MemberRajaMohammed.A3-Oct-19 23:29 
AnswerRe: WPF Pin
Richard Deeming4-Oct-19 2:59
communityengineerRichard Deeming4-Oct-19 2:59 
AnswerRe: WPF Pin
Richard MacCutchan4-Oct-19 4:22
communityengineerRichard MacCutchan4-Oct-19 4:22 
AnswerRe: WPF Pin
Gerry Schmitz4-Oct-19 7:32
mveGerry Schmitz4-Oct-19 7:32 Pin
RajaMohammed.A20-Sep-19 22:27
MemberRajaMohammed.A20-Sep-19 22:27 
AnswerRe: Pin
Richard MacCutchan21-Sep-19 3:58
communityengineerRichard MacCutchan21-Sep-19 3:58 Pin
RajaMohammed.A20-Sep-19 21:09
MemberRajaMohammed.A20-Sep-19 21:09 
AnswerRe: Pin
Richard MacCutchan20-Sep-19 22:07
communityengineerRichard MacCutchan20-Sep-19 22:07 
AnswerRe: Pin
Mycroft Holmes21-Sep-19 13:48
MemberMycroft Holmes21-Sep-19 13:48 
QuestionHow to use DataTrigger to run Storyboard? Pin
Pew_new20-Sep-19 9:00
MemberPew_new20-Sep-19 9:00 
QuestionWPF Pin
RajaMohammed.A19-Sep-19 3:35
MemberRajaMohammed.A19-Sep-19 3:35 
AnswerRe: WPF Pin
Richard Deeming19-Sep-19 3:58
communityengineerRichard Deeming19-Sep-19 3:58 
AnswerRe: WPF Pin
Mycroft Holmes19-Sep-19 14:07
MemberMycroft Holmes19-Sep-19 14:07 
QuestionWindow Not Refreshing Pin
Kevin Marois17-Sep-19 10:03
professionalKevin Marois17-Sep-19 10:03 
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
        CurrentTaskChanged($"Installing {featureName}");

        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();

        if (info.Contains("%"))
            // 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
UI Code
private void InstallExecuted()
    RemoteServicesInstaller.CurrentTaskChanged += CurrentTaskChanged;
    RemoteServicesInstaller.ProgressUpdated += ProgressUpdated;

private void CurrentTaskChanged(string action)
    InstallAction = action;

private void ProgressUpdated(double percent)
    InstallPercent = percent;

The two handlers here at the bottom DO get called - the UI just doesn't update during install. I can see the Debug.Print code sending the percent to the debug console. The UI just doesnt refresh.

Anyone have any thougts? Thanks!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Window Not Refreshing Pin
Richard Deeming17-Sep-19 10:34
communityengineerRichard Deeming17-Sep-19 10:34 
GeneralRe: Window Not Refreshing Pin
Kevin Marois17-Sep-19 11:03
professionalKevin Marois17-Sep-19 11:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.