WPF Showing a boolean with radiobuttons












-2














I'm currently in the process of making an application that has some CRUD views. I wanted to show a boolean in one of my views for editing a row. I used this answer here to try and solve this problem. I can edit the row once, if I try again I get a stackoverflow exception (whether I change to boolean value or not)



Resource declaration:



<UserControl.Resources>
<bconv:BoolInverterConverter x:Key="BoolInverterConverter" />
</UserControl.Resources>


Radio buttons:



<RadioButton Grid.Column="0" GroupName="istemplate"
Content="Yes" IsChecked="{Binding Survey.isTemplate, Mode=TwoWay}" />
<RadioButton Grid.Column="1" GroupName="istemplate" Content="No" Margin="10,0,0,0"
IsChecked="{Binding Survey.isTemplate, Mode=TwoWay, Converter={StaticResource BoolInverterConverter}}" />


The item I'm trying to edit the boolean (isTemplate) of:



[Table("Survey")]
public class Survey : EntityBase
{
[Required, StringLength(50)]
public string Name { get; set; }
public User ConfirmedBy { get; set; }
public Boolean isTemplate { get; set; }
public Assignment Assignment { get; set; }
public User User { get; set; }
[DataType(DataType.Date)]
public DateTime Date { get; set; }
}


If I forgot to include some information please ask!










share|improve this question






















  • That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow
    – sramalingam24
    Nov 15 at 22:56










  • @sramalingam24 Except for the fact that the checkbox is inverted a.t.m. it does work, thanks :)
    – Luke Derkzen
    Nov 15 at 23:14










  • I just made a small program, using your code and the converter from the link you provided. It works as expected. Your exception is not in the code you provided. My guess is, it's in your ViewModel. When you break in the debugger, what does the call stack tell you?
    – Nik
    Nov 16 at 0:40
















-2














I'm currently in the process of making an application that has some CRUD views. I wanted to show a boolean in one of my views for editing a row. I used this answer here to try and solve this problem. I can edit the row once, if I try again I get a stackoverflow exception (whether I change to boolean value or not)



Resource declaration:



<UserControl.Resources>
<bconv:BoolInverterConverter x:Key="BoolInverterConverter" />
</UserControl.Resources>


Radio buttons:



<RadioButton Grid.Column="0" GroupName="istemplate"
Content="Yes" IsChecked="{Binding Survey.isTemplate, Mode=TwoWay}" />
<RadioButton Grid.Column="1" GroupName="istemplate" Content="No" Margin="10,0,0,0"
IsChecked="{Binding Survey.isTemplate, Mode=TwoWay, Converter={StaticResource BoolInverterConverter}}" />


The item I'm trying to edit the boolean (isTemplate) of:



[Table("Survey")]
public class Survey : EntityBase
{
[Required, StringLength(50)]
public string Name { get; set; }
public User ConfirmedBy { get; set; }
public Boolean isTemplate { get; set; }
public Assignment Assignment { get; set; }
public User User { get; set; }
[DataType(DataType.Date)]
public DateTime Date { get; set; }
}


If I forgot to include some information please ask!










share|improve this question






















  • That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow
    – sramalingam24
    Nov 15 at 22:56










  • @sramalingam24 Except for the fact that the checkbox is inverted a.t.m. it does work, thanks :)
    – Luke Derkzen
    Nov 15 at 23:14










  • I just made a small program, using your code and the converter from the link you provided. It works as expected. Your exception is not in the code you provided. My guess is, it's in your ViewModel. When you break in the debugger, what does the call stack tell you?
    – Nik
    Nov 16 at 0:40














-2












-2








-2


0





I'm currently in the process of making an application that has some CRUD views. I wanted to show a boolean in one of my views for editing a row. I used this answer here to try and solve this problem. I can edit the row once, if I try again I get a stackoverflow exception (whether I change to boolean value or not)



Resource declaration:



<UserControl.Resources>
<bconv:BoolInverterConverter x:Key="BoolInverterConverter" />
</UserControl.Resources>


Radio buttons:



<RadioButton Grid.Column="0" GroupName="istemplate"
Content="Yes" IsChecked="{Binding Survey.isTemplate, Mode=TwoWay}" />
<RadioButton Grid.Column="1" GroupName="istemplate" Content="No" Margin="10,0,0,0"
IsChecked="{Binding Survey.isTemplate, Mode=TwoWay, Converter={StaticResource BoolInverterConverter}}" />


The item I'm trying to edit the boolean (isTemplate) of:



[Table("Survey")]
public class Survey : EntityBase
{
[Required, StringLength(50)]
public string Name { get; set; }
public User ConfirmedBy { get; set; }
public Boolean isTemplate { get; set; }
public Assignment Assignment { get; set; }
public User User { get; set; }
[DataType(DataType.Date)]
public DateTime Date { get; set; }
}


If I forgot to include some information please ask!










share|improve this question













I'm currently in the process of making an application that has some CRUD views. I wanted to show a boolean in one of my views for editing a row. I used this answer here to try and solve this problem. I can edit the row once, if I try again I get a stackoverflow exception (whether I change to boolean value or not)



Resource declaration:



<UserControl.Resources>
<bconv:BoolInverterConverter x:Key="BoolInverterConverter" />
</UserControl.Resources>


Radio buttons:



<RadioButton Grid.Column="0" GroupName="istemplate"
Content="Yes" IsChecked="{Binding Survey.isTemplate, Mode=TwoWay}" />
<RadioButton Grid.Column="1" GroupName="istemplate" Content="No" Margin="10,0,0,0"
IsChecked="{Binding Survey.isTemplate, Mode=TwoWay, Converter={StaticResource BoolInverterConverter}}" />


The item I'm trying to edit the boolean (isTemplate) of:



[Table("Survey")]
public class Survey : EntityBase
{
[Required, StringLength(50)]
public string Name { get; set; }
public User ConfirmedBy { get; set; }
public Boolean isTemplate { get; set; }
public Assignment Assignment { get; set; }
public User User { get; set; }
[DataType(DataType.Date)]
public DateTime Date { get; set; }
}


If I forgot to include some information please ask!







c# wpf data-binding stack-overflow staticresource






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 at 22:46









Luke Derkzen

158111




158111












  • That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow
    – sramalingam24
    Nov 15 at 22:56










  • @sramalingam24 Except for the fact that the checkbox is inverted a.t.m. it does work, thanks :)
    – Luke Derkzen
    Nov 15 at 23:14










  • I just made a small program, using your code and the converter from the link you provided. It works as expected. Your exception is not in the code you provided. My guess is, it's in your ViewModel. When you break in the debugger, what does the call stack tell you?
    – Nik
    Nov 16 at 0:40


















  • That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow
    – sramalingam24
    Nov 15 at 22:56










  • @sramalingam24 Except for the fact that the checkbox is inverted a.t.m. it does work, thanks :)
    – Luke Derkzen
    Nov 15 at 23:14










  • I just made a small program, using your code and the converter from the link you provided. It works as expected. Your exception is not in the code you provided. My guess is, it's in your ViewModel. When you break in the debugger, what does the call stack tell you?
    – Nik
    Nov 16 at 0:40
















That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow
– sramalingam24
Nov 15 at 22:56




That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow
– sramalingam24
Nov 15 at 22:56












@sramalingam24 Except for the fact that the checkbox is inverted a.t.m. it does work, thanks :)
– Luke Derkzen
Nov 15 at 23:14




@sramalingam24 Except for the fact that the checkbox is inverted a.t.m. it does work, thanks :)
– Luke Derkzen
Nov 15 at 23:14












I just made a small program, using your code and the converter from the link you provided. It works as expected. Your exception is not in the code you provided. My guess is, it's in your ViewModel. When you break in the debugger, what does the call stack tell you?
– Nik
Nov 16 at 0:40




I just made a small program, using your code and the converter from the link you provided. It works as expected. Your exception is not in the code you provided. My guess is, it's in your ViewModel. When you break in the debugger, what does the call stack tell you?
– Nik
Nov 16 at 0:40












2 Answers
2






active

oldest

votes


















1














The problem has been solved thanks to @sramalingam24 comment




That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow




The helper class I was using earlier can simply be deleted. All that's necessary is the CheckBox






share|improve this answer





























    0














    StackOverFlow Exception points to Recursively/Endlessly doing something.



    I havent seen your code but, wild guess - Check the Setter of you Binding: Survey.isTemplate. Are you assigning the CLR property or the Bound property.



    Ex:



    private string _Name = null;

    public string Name
    {
    get
    {
    return _Name; // If you do return Name here - it will be overflow exception
    }
    set
    {
    _Name = value; // If you do Name = value instead - it will be Overflow exception.
    NotifyPropertyChange("Name");
    }
    }





    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/3.0/"u003ecc by-sa 3.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%2f53328944%2fwpf-showing-a-boolean-with-radiobuttons%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














      The problem has been solved thanks to @sramalingam24 comment




      That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow




      The helper class I was using earlier can simply be deleted. All that's necessary is the CheckBox






      share|improve this answer


























        1














        The problem has been solved thanks to @sramalingam24 comment




        That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow




        The helper class I was using earlier can simply be deleted. All that's necessary is the CheckBox






        share|improve this answer
























          1












          1








          1






          The problem has been solved thanks to @sramalingam24 comment




          That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow




          The helper class I was using earlier can simply be deleted. All that's necessary is the CheckBox






          share|improve this answer












          The problem has been solved thanks to @sramalingam24 comment




          That should be a check box not a pair of radio buttons, where updating one calls the other leading to a cycle and the stack overflow




          The helper class I was using earlier can simply be deleted. All that's necessary is the CheckBox







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 at 15:09









          Luke Derkzen

          158111




          158111

























              0














              StackOverFlow Exception points to Recursively/Endlessly doing something.



              I havent seen your code but, wild guess - Check the Setter of you Binding: Survey.isTemplate. Are you assigning the CLR property or the Bound property.



              Ex:



              private string _Name = null;

              public string Name
              {
              get
              {
              return _Name; // If you do return Name here - it will be overflow exception
              }
              set
              {
              _Name = value; // If you do Name = value instead - it will be Overflow exception.
              NotifyPropertyChange("Name");
              }
              }





              share|improve this answer


























                0














                StackOverFlow Exception points to Recursively/Endlessly doing something.



                I havent seen your code but, wild guess - Check the Setter of you Binding: Survey.isTemplate. Are you assigning the CLR property or the Bound property.



                Ex:



                private string _Name = null;

                public string Name
                {
                get
                {
                return _Name; // If you do return Name here - it will be overflow exception
                }
                set
                {
                _Name = value; // If you do Name = value instead - it will be Overflow exception.
                NotifyPropertyChange("Name");
                }
                }





                share|improve this answer
























                  0












                  0








                  0






                  StackOverFlow Exception points to Recursively/Endlessly doing something.



                  I havent seen your code but, wild guess - Check the Setter of you Binding: Survey.isTemplate. Are you assigning the CLR property or the Bound property.



                  Ex:



                  private string _Name = null;

                  public string Name
                  {
                  get
                  {
                  return _Name; // If you do return Name here - it will be overflow exception
                  }
                  set
                  {
                  _Name = value; // If you do Name = value instead - it will be Overflow exception.
                  NotifyPropertyChange("Name");
                  }
                  }





                  share|improve this answer












                  StackOverFlow Exception points to Recursively/Endlessly doing something.



                  I havent seen your code but, wild guess - Check the Setter of you Binding: Survey.isTemplate. Are you assigning the CLR property or the Bound property.



                  Ex:



                  private string _Name = null;

                  public string Name
                  {
                  get
                  {
                  return _Name; // If you do return Name here - it will be overflow exception
                  }
                  set
                  {
                  _Name = value; // If you do Name = value instead - it will be Overflow exception.
                  NotifyPropertyChange("Name");
                  }
                  }






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 16 at 7:10









                  Prateek Shrivastava

                  888511




                  888511






























                      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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2f53328944%2fwpf-showing-a-boolean-with-radiobuttons%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

                      How to change which sound is reproduced for terminal bell?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?