As the title suggests, I am having some issues when trying to programmatically check a radio button in a Windows 8 Store App. So I realize on a WinForms .NET application I would do something like:
rad.Checked = true;
In WinRT, I am trying this:
control.RadYes.IsChecked = true;
This is what I would assume would cause the Radio Button to be pressed; however, in the UI, it still shows nothing is checked. If I place a breakpoint, I can hover over RadYes, and it shows the property = true. Is this not the correct way to do this?
The idea, is I am allowing a user to pick back up where they left on when filling out a form. So it retrieves the values from the database and correctly getting into my switch/case to set the value--but the UI doesn't change.
Another thing I noticed that I am also about to try--is that I didn't assign a Group to my 3 Radio Buttons. Can someone clue me in as to what I might be doing wrong? Thanks!
OK, so my solution was to add GroupName="YesNoNA" in the XAML controls. I didn't change anything else, and now it works. I searched for an hour trying to find information about this, so hopefully this will help someone else out.
Related
So I'm currently trying to access check box items held as a collection within a combo box. My problem is, when I go to set:
var dropGenre = Drop_Genre.Items;
and change the position each run through a loop, I cant seem to access anything "check box like" at any point. I'm trying to see which items in the drop down are "checked" and return the name of those items.
I tried looking through the windows documentation but didn't have any luck finding out about check boxes within combo boxes; in fact most sources I checked were asking if it was even possible and didn't seem to reference this functionality at all. Thanks, sorry if this is poor formatting, first time asking something on here.
I came across a tutorial and some example code for an audio converter. You select the format you want to convert to from a drop down, and when you do all sorts of options appear in a previously blank area, different options based on the format you choose. It's called Audio Converter .NET and is from same author as Audio CD Ripper .NET. I can't find the tutorial, but here is a screenshot.
See how on the right there is extra controls that are not on the left. I was experimenting trying to add another category. I added it to the dropdown, but am unsure how to make it so certain fields come up when it is selected.
I understand that they create those controls for those items, but I don't see how they call the correct one when the combo box selects something. I see controls are created, but if I try to duplicate the controls into another entry in the combo box they don't show up for either the new or old one I was duplicating from.
What's the best way to go about achieving something like this?
Thanks
The easiest way is to create the controls needed for every option in the dropdown inside a panel, and simply turn it's visibility property from false to true whenever it's corresponding option is selected using the combobox's SelectedIndexChanged event handler. (And don't forget to turn the current visible panel's visibility to false)
I'm using the ObjectListView control from here.
I'd like to detect when a user right clicks the headers and hides or shows a column. Basically a ColumnVisibilityChanged event. The reason I want to detect this is to save the visible columns between sessions.
The ColumnWidthChanged event fires when this occurs (not on the column that has been removed), so I could iterate through AllColumns and check the value of IsVisible. However, that seems hacky and I'd like to avoid it. Also, that would get run several times when it didn't need to.
Anyone know of a better way of detecting a column being hidden or shown?
Well I found a solution that wasn't quite what I was looking for, but possibly better.
ObjectListView has SaveState() and RestoreState() methods as described here.
I just don't understand how this is done. I've gone through several questions here and from a few other websites.
Basically, a company will be adding process steps, and I want there to be a textbox with a button next to it that reads "Add another step." Once clicked, a new textbox will appear beneath the current one, and the button will be moved next to the new text box. What do I need to do?
Well things will get a little more complex once you ask how to maintain ViewState. However, since you didn't ask that (yet), the simple answer is just that on button click event you should instantiate a new TextBox and Insert it into the Controls before the Button.
Okay, finally found an answer I can understand. Using listviews seems to be a good way to go. I found this website
http://geekswithblogs.net/QuandaryPhase/archive/2008/10/19/asp.net-alternatives-to-dynamic-controls---part-1.aspx
And I got the results I wanted.
I'm making a winform in C# using Visual Studio 2008.
Currently, I have a tabcontrol, containing 2 tabs.
In the first the, there is a button. When I click it, I must be taken to the second tab.
Problem is, I don't know how. I've tried debugging, looking into al kinds of Properties and messing around with them, but I found nothing that helps.
Does anybody here know how to pull this off?
Extra info: my variables are named tabControl1, textTab and logTab.
I'm in textTab, click on a button there and I want to be taken to logTab. That's it basically.
Did you try this?
tabControl1.SelectedTab = logTab;
You can set either the SelectedIndex property or the SelectedTab property of the tab control to switch tabs.