Checkbox content Visibility - silverlight-4.0

Is it possible to hide Checkbox content in Silverlight
CheckBox cb = new CheckBox();
cb.Name = "checkboxName";
cb.Content = 99;
// value that I need somewhere else, but don't want user to see it
Thank you

If you don't want content to be seen just keep it empty and use tag property to store any object.
i.e cb.tag = Anything. => this can be accessed anywhere.

Related

How to open a winform at same location and with same size of its parent in vb.net? Parent may be Winform or UserControl

Dim popCus As New PopCustomer()
popCus.StartPosition = FormStartPosition.Manual
popCus.Location = New Point(ctrList.Location)
popCus.Size = New Size(ctrList.Size)
popCus.ShowDialog()
Here ctrList is a UserControl's object and PopCustomer if a Winform.
I want open PopCustomer at same location and same size of ctrList.
The problem there is that the Location of the UserControl is relative to its own parent while for the form it's relative to the screen.
If you change this:
popCus.Location = New Point(ctrList.Location)
to this:
popCus.Location = ctrList.PointToScreen(Point.Empty)
then you'll get the effect you want. You can actually use the same code for a form so that means that you can write a single method with a Control parameter and then use that parameter to set the Location and Size of the new form. You can then call that method and pass either a form or a user control as an argument.

Accessing Data From Dynamically Generated TextFields

I'm currently working on functionality that would allow the user to add a set of checkboxes, textfields, and buttons on demand. Afterward, I would like to be able to access the text stored in the textfield as well as the state of the checkbox.
My current code is as follows:
#FXML VBox box = new VBox(10);
{
HBox horizBox = new HBox(10);
Button button3 = new Button("Hi");
TextField textTest = new TextField();
CheckBox check3 = new CheckBox();
box.getChildren().addAll(horizBox);
horizBox.getChildren().addAll(textTest, check3, button3);
System.out.println(textTest.getText());
}
Even after giving a variety of inputs, the output is still blank. How do I access the data in a dynamically generated textbox? For example, if I wanted to get the input from the fourth textbox that the user made, how would I go about doing that?
Thanks.

Can't see dropdown items in Datagridviewcomboboxcell

I have created Datagridviewcomboboxcells as follows, each of which have 2-3 items.
I'm able to see the Datagridviewcomboboxcells with the appropriate values inside the comboboxcell, but I'm not able to see the dropdown list when i click on the comboboxcell.
Should I write a separate event handler to display the dropdown list ? Does it not dropdown by default ?
Dim Dgv2cb_ColdStart As New DataGridViewComboBoxCell
Dgv2cb_ColdStart.Items.Add("C:\pd_DelAll.pl")
Dgv2cb_ColdStart.Items.Add("No Cold Start")
dgv2.Rows.Add("ColdStart")
dgv2.Rows(rowIndex).Cells(1) = Dgv2cb_ColdStart
If temp_profile.ColdStart = "" Then
dgv2.Rows(rowIndex).Cells(1).Value = Dgv2cb_ColdStart.Items(1)
Else
dgv2.Rows(rowIndex).Cells(1).Value = Dgv2cb_ColdStart.Items(0)
End If
Surprising thing is the same code on another backup of the project works, but that is an older version that i can't use now.
I'm not able to reproduce the error, as to what is causing the dropdown not to occur.

Issue of TextCompletion of AutoCompleteBox in silverlight

I have created my own cutom control in combination of two :
button and a autocompletebox in silverlight.
On a click event of a button i bind the itemsource of a autocompletebox and do this :
acb.ItemsSource = p.ToArray();//list of an object of a class(person)
acb.MinimumPrefixLength = 0;
acb.IsDropDownOpen = true;
And on a textchanged event of a autocompletebox i call a service method to fetch persons based on the search text and do this :
ReferringProvider.ItemsSource = searchproviders;
this.ReferringProvider.tbComboValue.MinimumPrefixLength = 0;
this.ReferringProvider.tbComboValue.IsDropDownOpen = true;
But i lose TextCompletion, the text is not completed with the first item of drop downlist?
Any idea why so? or any suggestions
Please Thanks in advance.
I wrote a blog sometime back on autocomplete text box, but I did not use button. I am not sure you need button to initiate autocomplete. Corrent me I am wrong.
http://csharprambling.wordpress.com/2011/01/26/autocompletebox-to-auto-complete-data-entry/

Dynamically Created LABEL Element not showing up in XUL application

I'm trying to dynamically create a set of labels in my XUL Runner application. I have an HBox like so:
<hbox class="upload-attachments"></hbox>
If I manually assign a label element to it like so:
<hbox class="upload-attachments"><label value="test" /></hbox>
It works fine. Also, when I query the object in Javascript I can access the test label.
When I try and create new label elements programmatically it fails. This is roughly what I am doing:
var attachments = view.query_first('.upload-attachments');
var label = view.ownerDocument.createElement('label');
label.value = "Some value."
attachments.appendChild(label);
var childCount = attachments.childNodes.length;
The query_first method is just a call to the Sly Query Selector engine and in other cases works fine. The childCount value is updating appropriately, and as I said, I can access and manipulate any labels I manually add to the hbox.
Thanks in advance,
Either append it with the attribute set, or set the property after inserting:
var label = view.ownerDocument.createElement('label');
attachments.appendChild(label);
label.value = "Some value."
-- or --
var label = view.ownerDocument.createElement('label');
label.setAttribute("value", "Some value.");
attachments.appendChild(label);
The reasoning being that, before the element was inserted, the property setters don't work.