I wouldn't approach it like this. A simpler way to do this would be to implement a value converter which did the heavy work of just displaying the appropriate image, rather than showing and hiding elements.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
With a limited Grid space, I want to have a list of TextBoxes (email addresses). If the TextBoxes fill up the Grid space I want a vertical scroll bar to appear, so that the TextBoxes don't run into the next Grid space. If the scroll bar is there (but grayed out) because the TextBoxes do not fill up the Grid space, that's OK.
Ahh. Yes. I didn't quite understand that. I haven't done any Binding before, but looks pretty straightforward. I'm sure I can figure it out with your sample. I appreciate it.
I had actually created a ListBox and populated it with TextBlocks showing the Email #, but that's it. I couldn't figure out how to populate it with a second item TextBoxes. Binding looks like the answer.
Stumped. I have the following Grid setup. 3 columns. Within Column 0, I have 5 rows. Within Column 0, Row 3, I have 2 more columns. It works. However, I can't get the 'EMAIL ADDRESSES' TextBlock to appear in Column 2. Even with Grid.Column = "0" Grid.Row = "2". Where does it need to be in the code? Also, if I want controls in Row 3, now I have a second Column constraint to deal with (Col 0, Row 3, Column 0 or 1). How do I deal with that? I tried naming the Grid, but it doesn't allow that type of syntax. I think that's only for C# code.
Try putting Grid.Column="1" into the TextBlock, as the count is zero based. But, I think you are getting a bit confused as to how your grid looks. Reading through your Grid code, I get the following visualisation:
You are correct. That's what it looks like, except not to scale. I have this test code running in Visual C#. I wanted to put the 'EMAIL ADDRESSES' TextBlock in Row 2 as a header. But, I figured it out. You have to put the TextBlock code BEFORE the redefinition of the Row 3 Grid. That actually makes sense. I'm guessing Row 2 is out of scope once Row 3 is redefined into 2 columns.
BTW, I come from the embedded world of 25+ years, but not much Windows programming. I'm just dangerous enough to get a basic software app working in Visual C#. But, with fairly basic controls. I'm now trying to enhance the app with a few more complex controls.
I took a different approach. I'm trying to create a ListBox on the fly without using any XAML code. I got it working - almost. What I have is an array of TextBoxes of 'Zone Descriptions'. I can put those into the ListBox as ListBoxItems, and it works great - no problem.
I want to add at the front of the TextBox a TextBlock or header that says 'Zone 1' or whatever the zone is along with the TextBox, which is user changeable. I have an array of TextBlocks. But, I can't (or don't know how to) adjust the ListBoxItem.Content to hold both the TextBlock and TextBox combo. LBI[i].Content = TBlkZoneDesc[i] + TBxZoneDesc[i] is what I want to do, but that syntax is not allowed. Doing either one separately works fine, but not both.
Do you have a suggestion on how to do that?
ListBox LBZoneDesc = new ListBox();
LBZoneDesc.Width = 300;
LBZoneDesc.Height = 240;
ListBoxItem LBI = new ListBoxItem;
for (byte i = 0; i < 5; i++)
LBI[i] = new ListBoxItem();
LBI[i].Padding = new Thickness(2);
// LBI[i].Content = TBlkZoneDesc[i];
LBI[i].Content = TBxZoneDesc[i];
Last Visit: 31-Dec-99 18:00 Last Update: 6-Jul-22 14:53