Hi,
I'm using an UltraControlContainerEditor to embed an Ultrabutton in a cell of an Ultratree. Everything works fine except that the button does not display the Text, or any appearance property for that matter. The button looks like I want it in the designer, but when I run the application I only get a button with a default look and no text on it.
I'm using NetAdvantage 2011.2 for Windows forms. Is this a bug or am I doing something wrong?
Thanks,
Cassio
Cassio Nishiguchi said:Setting the Value property of the cell did indeed make it appear on the button, which solves my problem. I was setting the RenderingControlPropertyName and EditingControlPropertyName to "Text" before, thinking that it would use the "Text" property of the button to set the value for the cell. However, it seems like it goes the other way, using the value of the cell to set the "Text" on the button. I'm still confused by that, but it's working.
Using a button in a cell like you are doing here is a little unusual because I button is not editable and doesn't really need to pick up a value from the cell. So it's not surprising that you might be thinking it should work the other way with a button. But suppose you were using a TextBox. In that case, you would want the TextBox to show the value of the cell and when the user changed the text of that TextBox, you would want the cell to pick up the changes. So the property you are specifying is the property on your control that is hooked up to the Value of the cell.
Cassio Nishiguchi said:I figured out why the colors and style weren't working too. It wasn't because of OS themes, I had that set to false. It's because UseAppStyling was set to true and my control is part of a much larger application, and the appstyling is being set somewhere else.
Ah, that makes sense.
Hi Mike, thanks for the reply. Setting the Value property of the cell did indeed make it appear on the button, which solves my problem. I was setting the RenderingControlPropertyName and EditingControlPropertyName to "Text" before, thinking that it would use the "Text" property of the button to set the value for the cell. However, it seems like it goes the other way, using the value of the cell to set the "Text" on the button. I'm still confused by that, but it's working.
I figured out why the colors and style weren't working too. It wasn't because of OS themes, I had that set to false. It's because UseAppStyling was set to true and my control is part of a much larger application, and the appstyling is being set somewhere else.
Hi Cassio,
Regarding the button colors, my guess is that your button is using OS themes. The operating system themes are all-or-nothing, so if they are on, you can't change the colors individually. Try setting UseOsThemes to False on your UltraButton.
Regarding the Text, my guess is that you have not set the RenderingControlPropertyName or EditingControlPropertyname on the UltraControlContainerEditor. That's okay, but if you don't set these, the UltraControlContainerEditor will fall back to using the Value property, if there is one, and then back to Text. There's no Value property on UltraButton, so it will likely be using Text. That means that the button's Text property will be set to the Value of the tree cell, which is likely empty. So your text is probably getting erased.
The solution is to set the Value of the cell in the tree to the text you want the button to display and the button should pick that up.