Changing WPF border visibility after opening dialog box
NickName:wilk Ask DateTime:2014-06-18T23:34:20

Changing WPF border visibility after opening dialog box

I have a border control that I am using as a loading screen overlay over my main window for when I am opening a couple large files. To do this, I am changing the visibility property of the border to Visible after the dialog box is created. The problem is that the border never actually shows up. This is the code that does not work:

  var openFileDialog = new ViewerOpenFileDialog();
  openFileDialog.ShowDialog();
  LoadingScreen.Visibility = Visibility.Visible;
  ViewerViewModel.OpenFile(openFileDialog.ParamFileName, openFileDialog.IdFileName);
  LoadingScreen.Visibility = Visibility.Hidden;

After I close the dialog, the border never becomes visible.

This code DOES work, however:

   LoadingScreen.Visibility = Visibility.Visible;
   var openFileDialog = new ViewerOpenFileDialog();
   openFileDialog.ShowDialog();
   ViewerViewModel.OpenFile(openFileDialog.ParamFileName, openFileDialog.IdFileName);
   LoadingScreen.Visibility = Visibility.Hidden;

The border becomes visible until after my files load, however it is visible while my dialog box is open which is not ideal.

Here is the XAML for my border:

    <Border Name="LoadingScreen" Background="#80000000" VerticalAlignment="Stretch" Visibility="Hidden">
        <Grid>
            <TextBlock Margin="0" TextWrapping="Wrap" Text="Loading, Please Wait..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30" FontWeight="Bold" />
        </Grid>
    </Border>

Copyright Notice:Content Author:「wilk」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/24289637/changing-wpf-border-visibility-after-opening-dialog-box

More about “Changing WPF border visibility after opening dialog box” related questions

Changing WPF border visibility after opening dialog box

I have a border control that I am using as a loading screen overlay over my main window for when I am opening a couple large files. To do this, I am changing the visibility property of the border to

Show Detail

Changing image color not working in dialog box

I am changing color of an image which is in drawable folder. Drawable border = ContextCompat.getDrawable(homeActivity.this, R.drawable.buynow_button); ColorFilter borderFilter = new

Show Detail

How to close popup window when dialog box open in wpf?

I am opening one popup during the run time after that i will open the dialog box using window key down event now my previous popup still shows? how to close the previous pop up window ? Can any one...

Show Detail

How i can stop the code after opening a dialog box?

I got a problem with my code : $("#lbCreer").click(function (e) { e.preventDefault(); $("input:checked").each(function () { var id = this.value; ...

Show Detail

Save File Dialog boxes in VB WPF

In Windows Forms it seems there are precreated dialog boxes for opening and saving files. That is greyed out in the WPF toolbox. Is there an easy way to create such a dialog box using WPF?

Show Detail

WPF image visibility is not changing

I have the following method in my WPF project (.net 4): private void MyMethod(){ imgMyImage.Visibility = Visibility.Visible; DoWork(); imgMyImage.Visibility = Visibility.Collapsed; } ...

Show Detail

How can I delay the visibility of my dialog box until tinyMCE has opened?

I have the following code: open: function (event, ui) { if ($(this).data('action') == "Editing") { tinyMCE.init(window.tinyMCEOptions); } else {

Show Detail

how to move jquery ui dialog box to top position after opening it

Can any one tell me how i move my dialog box to top position after opening it. $("#addPage").on( "dialogopen", function( event, ui ) { $( "#addPage" ).dialog( "option", "position", { my: &

Show Detail

Dialog Box not Closing After pressing X Button

I've one scenario. I'm opening a dialog box, but my parent window refreshes after every one minute. Let's say my dialog box is opened for 5 minutes, then I have to press 5 times the X button to close

Show Detail

Set Parent for the dialog box when the same dialog box can be opened from both WPF and WinForm application

I have an application which have 2 modules (one made from WinForms and other made of WPF). I have an Export Button on both of the modules. Export button is used to Export the grid to Excel File and...

Show Detail