WPF Showing a boolean with radiobuttons
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
add a comment |
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
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
add a comment |
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
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
c# wpf data-binding stack-overflow staticresource
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
add a 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
– 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
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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");
}
}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Nov 16 at 15:09
Luke Derkzen
158111
158111
add a comment |
add a comment |
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");
}
}
add a comment |
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");
}
}
add a comment |
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");
}
}
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");
}
}
answered Nov 16 at 7:10
Prateek Shrivastava
888511
888511
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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