wpf break IsVisibleChangedEventC# loop - break vs. continueWhat is the correct way to create a single-instance WPF application?WPF image resourcesFading in and fading out for a formASP.NET usercontrol: check if usercontrol is visibleHow to know if the UserControl is active other than using IsFocusedWPF UserControl ClickLoad like event in Windows Forms for any control like textbox, checkbox?UserControl with panel and buttonsIsVisibleChanged is not triggered when TabItem visibility is programatically updated

Have there been any countries that voted themselves out of existence?

What jurisdiction do Scottish courts have over the Westminster parliament?

Parallel resistance in electric circuits

How do I determine what is "magic" and "bearing magic" for Detect Magic?

Can I conceal an antihero's insanity - and should I?

How to work with a technician hired with a grant who argues everything

Maintenance tips to prolong engine lifespan for short trips

Can I disable a battery powered device by reversing half of its batteries?

Resume: How to quantify my contributions as a software engineer?

Is there a reliable way to hide/convey a message in vocal expressions (speech, song,...)

Why island and not light?

Is there any way to land a rover on the Moon without using any thrusters?

Does my opponent need to prove his creature has morph?

What are uses of the byte after BRK instruction on 6502?

Can a corpse possessed by a Dybbuk be turned via Turn Undead?

Why is the T-1000 humanoid?

How do email clients "send later" without storing a password?

Fight a biblical flood apart from building barriers

Relocation error, error code (127) after last updates

Are scroll bars dead in 2019?

Telling my mother that I have anorexia without panicking her

I asked for a graduate student position from a professor. He replied "welcome". What does that mean?

How seriously should I take a CBP interview where I was told I have a red flag and could only stay for 30 days?

Why is Kirchoff's loop rule true in a DC circuit?



wpf break IsVisibleChangedEvent


C# loop - break vs. continueWhat is the correct way to create a single-instance WPF application?WPF image resourcesFading in and fading out for a formASP.NET usercontrol: check if usercontrol is visibleHow to know if the UserControl is active other than using IsFocusedWPF UserControl ClickLoad like event in Windows Forms for any control like textbox, checkbox?UserControl with panel and buttonsIsVisibleChanged is not triggered when TabItem visibility is programatically updated






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have my usercontrol that has the IsVisibleChanged method.. that is fired when become visibile or when hide..



I wish, in some conditions break this event to avoid the hide set.... how can I do this?



the event is this:



private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

if ((bool)e.NewValue == true)

// goes visible

else

// hide it!
if (myCondition == true)

// here I wish break the hide event and mantain the user control visible





thanks in advance










share|improve this question



















  • 1





    set e.handled to true

    – Denis Schaf
    Mar 28 at 10:10











  • I haven't the e.handled property docs.microsoft.com/it-it/dotnet/api/…

    – ghiboz
    Mar 28 at 10:18











  • If you want to avoid that the control becomes hidden, why do you hide it in the first place? There is nothing you can do about this in the event handler that is being invoked in reponse to the control being hidden or collapsed.

    – mm8
    Mar 28 at 13:29

















0















I have my usercontrol that has the IsVisibleChanged method.. that is fired when become visibile or when hide..



I wish, in some conditions break this event to avoid the hide set.... how can I do this?



the event is this:



private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

if ((bool)e.NewValue == true)

// goes visible

else

// hide it!
if (myCondition == true)

// here I wish break the hide event and mantain the user control visible





thanks in advance










share|improve this question



















  • 1





    set e.handled to true

    – Denis Schaf
    Mar 28 at 10:10











  • I haven't the e.handled property docs.microsoft.com/it-it/dotnet/api/…

    – ghiboz
    Mar 28 at 10:18











  • If you want to avoid that the control becomes hidden, why do you hide it in the first place? There is nothing you can do about this in the event handler that is being invoked in reponse to the control being hidden or collapsed.

    – mm8
    Mar 28 at 13:29













0












0








0








I have my usercontrol that has the IsVisibleChanged method.. that is fired when become visibile or when hide..



I wish, in some conditions break this event to avoid the hide set.... how can I do this?



the event is this:



private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

if ((bool)e.NewValue == true)

// goes visible

else

// hide it!
if (myCondition == true)

// here I wish break the hide event and mantain the user control visible





thanks in advance










share|improve this question














I have my usercontrol that has the IsVisibleChanged method.. that is fired when become visibile or when hide..



I wish, in some conditions break this event to avoid the hide set.... how can I do this?



the event is this:



private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

if ((bool)e.NewValue == true)

// goes visible

else

// hide it!
if (myCondition == true)

// here I wish break the hide event and mantain the user control visible





thanks in advance







c# wpf mahapps.metro .net-4.6






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 10:06









ghibozghiboz

4,15419 gold badges68 silver badges116 bronze badges




4,15419 gold badges68 silver badges116 bronze badges










  • 1





    set e.handled to true

    – Denis Schaf
    Mar 28 at 10:10











  • I haven't the e.handled property docs.microsoft.com/it-it/dotnet/api/…

    – ghiboz
    Mar 28 at 10:18











  • If you want to avoid that the control becomes hidden, why do you hide it in the first place? There is nothing you can do about this in the event handler that is being invoked in reponse to the control being hidden or collapsed.

    – mm8
    Mar 28 at 13:29












  • 1





    set e.handled to true

    – Denis Schaf
    Mar 28 at 10:10











  • I haven't the e.handled property docs.microsoft.com/it-it/dotnet/api/…

    – ghiboz
    Mar 28 at 10:18











  • If you want to avoid that the control becomes hidden, why do you hide it in the first place? There is nothing you can do about this in the event handler that is being invoked in reponse to the control being hidden or collapsed.

    – mm8
    Mar 28 at 13:29







1




1





set e.handled to true

– Denis Schaf
Mar 28 at 10:10





set e.handled to true

– Denis Schaf
Mar 28 at 10:10













I haven't the e.handled property docs.microsoft.com/it-it/dotnet/api/…

– ghiboz
Mar 28 at 10:18





I haven't the e.handled property docs.microsoft.com/it-it/dotnet/api/…

– ghiboz
Mar 28 at 10:18













If you want to avoid that the control becomes hidden, why do you hide it in the first place? There is nothing you can do about this in the event handler that is being invoked in reponse to the control being hidden or collapsed.

– mm8
Mar 28 at 13:29





If you want to avoid that the control becomes hidden, why do you hide it in the first place? There is nothing you can do about this in the event handler that is being invoked in reponse to the control being hidden or collapsed.

– mm8
Mar 28 at 13:29












2 Answers
2






active

oldest

votes


















1
















What you're trying to do, should be done before the Visibility property is changed. The event IsVisibleChanged will be triggered after the Visibility is changed. So handling it will not help.



If you're using MVVM, I would suggest you to use IValueConverter to handle this kind of scenario. Using Style.Triggers is also one more option.






share|improve this answer
































    0
















    If i understand right, try to use a flag and assign it as true inside your condition and then put your whole code inside the checking of this flag.
    For eg:



    private bool isBreaked=false;

    private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

    if(!isBreaked)

    if ((bool)e.NewValue == true)

    // goes visible

    else

    // hide it!
    if (myCondition == true)

    // here I wish break the hide event and mantain the user control visible
    isBreaked = true;









    share|improve this answer



























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );














      draft saved

      draft discarded
















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394871%2fwpf-break-isvisiblechangedevent%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1
















      What you're trying to do, should be done before the Visibility property is changed. The event IsVisibleChanged will be triggered after the Visibility is changed. So handling it will not help.



      If you're using MVVM, I would suggest you to use IValueConverter to handle this kind of scenario. Using Style.Triggers is also one more option.






      share|improve this answer





























        1
















        What you're trying to do, should be done before the Visibility property is changed. The event IsVisibleChanged will be triggered after the Visibility is changed. So handling it will not help.



        If you're using MVVM, I would suggest you to use IValueConverter to handle this kind of scenario. Using Style.Triggers is also one more option.






        share|improve this answer



























          1














          1










          1









          What you're trying to do, should be done before the Visibility property is changed. The event IsVisibleChanged will be triggered after the Visibility is changed. So handling it will not help.



          If you're using MVVM, I would suggest you to use IValueConverter to handle this kind of scenario. Using Style.Triggers is also one more option.






          share|improve this answer













          What you're trying to do, should be done before the Visibility property is changed. The event IsVisibleChanged will be triggered after the Visibility is changed. So handling it will not help.



          If you're using MVVM, I would suggest you to use IValueConverter to handle this kind of scenario. Using Style.Triggers is also one more option.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 10:46









          dhilmathydhilmathy

          2,0182 gold badges13 silver badges23 bronze badges




          2,0182 gold badges13 silver badges23 bronze badges


























              0
















              If i understand right, try to use a flag and assign it as true inside your condition and then put your whole code inside the checking of this flag.
              For eg:



              private bool isBreaked=false;

              private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

              if(!isBreaked)

              if ((bool)e.NewValue == true)

              // goes visible

              else

              // hide it!
              if (myCondition == true)

              // here I wish break the hide event and mantain the user control visible
              isBreaked = true;









              share|improve this answer





























                0
















                If i understand right, try to use a flag and assign it as true inside your condition and then put your whole code inside the checking of this flag.
                For eg:



                private bool isBreaked=false;

                private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

                if(!isBreaked)

                if ((bool)e.NewValue == true)

                // goes visible

                else

                // hide it!
                if (myCondition == true)

                // here I wish break the hide event and mantain the user control visible
                isBreaked = true;









                share|improve this answer



























                  0














                  0










                  0









                  If i understand right, try to use a flag and assign it as true inside your condition and then put your whole code inside the checking of this flag.
                  For eg:



                  private bool isBreaked=false;

                  private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

                  if(!isBreaked)

                  if ((bool)e.NewValue == true)

                  // goes visible

                  else

                  // hide it!
                  if (myCondition == true)

                  // here I wish break the hide event and mantain the user control visible
                  isBreaked = true;









                  share|improve this answer













                  If i understand right, try to use a flag and assign it as true inside your condition and then put your whole code inside the checking of this flag.
                  For eg:



                  private bool isBreaked=false;

                  private void MetroContentControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)

                  if(!isBreaked)

                  if ((bool)e.NewValue == true)

                  // goes visible

                  else

                  // hide it!
                  if (myCondition == true)

                  // here I wish break the hide event and mantain the user control visible
                  isBreaked = true;










                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 28 at 10:34









                  sijovwsijovw

                  5011 bronze badges




                  5011 bronze badges































                      draft saved

                      draft discarded















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394871%2fwpf-break-isvisiblechangedevent%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript