views:

105

answers:

1

Hi, I just need some quick help on syntax. I'm doing a WPF project and decided to try it out with Visual Basic. So, basically I'm trying to set the height of a row in a Grid. I'm not great at programming but with C# I managed somehow to figure it out, without remembering how. It actually looks like an animation because when clicking the button, the height of one row smoothly goes down to 0.

But I'm trying to even reach that property and I can't figure out the context. The row is called "AnimationRow" and I can reach that, but where do I set the height? And how would the syntax look like?

A: 

It's really just as simple as setting the Height property on the row object. Try the following:

Dim row = grid.RowDefinitions.Single(Function(row) row.Name = "AnimationRow")
row.Height = New GridLength(50);
Noldorin
Also, note that whatever you're trying to do, it can probably be done more elegantly in XAML code.
Noldorin
Really? How would I go about if I wanted to change the height property through XAML code then? I've been looking into it and XAML seems very easy. But I think it seems like a huge mess of code and I find it very hard to get an overview of what lies where. Would it be possible to do this without even touching XAML code? Just through the interface?
Kenny Bones
@Kenny: Not sure quite what you mean. You'd have to provide more context/additional code for me to suggest what the XAML would be.
Noldorin
Well, that's the thing really. I know that Expression Blend creates XAML code dynamically, but in order to make a button manipulate the height of a row in a Grid, would something like that rely of manually editing XAML code? Or could it somehow be done through the built in functions of Expression Blend?
Kenny Bones
Just use Visual Studio for writing the XAML, so long as it's simple. These additional questions of yours should really be asked separately btw...
Noldorin