<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programming with .NET - General</title><link>http://forums.silverlight.net/forums/17.aspx</link><description>General discussions around authoring Silverlight .NET applications.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: How to set the row height of a Grid in the code?</title><link>http://forums.silverlight.net/forums/thread/186539.aspx</link><pubDate>Wed, 11 Mar 2009 17:21:21 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:186539</guid><dc:creator>darktatami</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/186539.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=186539</wfw:commentRss><description>&lt;p&gt;Awesome, thanks! &lt;/p&gt;</description></item><item><title>Re: How to set the row height of a Grid in the code?</title><link>http://forums.silverlight.net/forums/thread/186403.aspx</link><pubDate>Wed, 11 Mar 2009 13:43:32 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:186403</guid><dc:creator>bryant</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/186403.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=186403</wfw:commentRss><description>&lt;p&gt;Just tell the image not to stretch and you won&amp;#39;t need to set the width/height. &lt;/p&gt;
&lt;p&gt;image.Stretch = Stretch.None;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to set the row height of a Grid in the code?</title><link>http://forums.silverlight.net/forums/thread/186387.aspx</link><pubDate>Wed, 11 Mar 2009 13:15:20 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:186387</guid><dc:creator>darktatami</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/186387.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=186387</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;That sounds like that&amp;#39;s what is happeneing. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#39;m adding an image and not setting the dimensions, I guess what was throwing me off was that it was correctly drawing the image (which is a 300 x150). Even though it was drawing the image correctly 300x150 it didn&amp;#39;t actually have the width and height set.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here is what I was doing:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var grid = new Grid();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; grid.ColumnDefinitions.Add(new ColumnDefinition()); &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var image = new Image();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var imagePath = &amp;quot;../../Resources/Images&amp;quot; + path;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var uri = new Uri(imagePath, UriKind.Relative);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var bitmap = new System.Windows.Media.Imaging.BitmapImage(uri);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; image.Source = bitmap;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; image .SetValue(Grid.ColumnProperty, 0);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; image .SetValue(Grid.RowProperty,0);&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var row = new RowDefinition();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; row.Height = new GridLength(150.0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; grid.RowDefinitions.Add(row);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; grid.Children.Add(newImage);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _canvas.Children.Add(grid);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; grid.SetValue(Canvas.LeftProperty, ViewConstants.RESOLUTION_WIDTH - 300);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; grid.SetValue(Canvas.TopProperty, 25.0);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; grid.SetValue(Canvas.ZIndexProperty, 1);&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Setting the Height &amp;amp; Width in the code before I call the row.Height makes this work properly, thanks :)&lt;/p&gt;&lt;p&gt;From what I can tell though, the code can not determine the width or height of an image that you add in this manner. How do you get those properties without hard coding them? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: How to set the row height of a Grid in the code?</title><link>http://forums.silverlight.net/forums/thread/186180.aspx</link><pubDate>Wed, 11 Mar 2009 04:48:52 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:186180</guid><dc:creator>bryant</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/186180.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=186180</wfw:commentRss><description>&lt;p&gt;Your code shouldn&amp;#39;t set it to 150%, it should only be 150 pixels high. What is in the row? Perhaps what you are putting in the row doesn&amp;#39;t have a height so it is sizing to fit the area it has. &lt;/p&gt;</description></item><item><title>How to set the row height of a Grid in the code?</title><link>http://forums.silverlight.net/forums/thread/186177.aspx</link><pubDate>Wed, 11 Mar 2009 04:38:52 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:186177</guid><dc:creator>darktatami</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/186177.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=186177</wfw:commentRss><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#39;m just getting started (frustrated with flash) and want to learn how to also do everything in code, not just xaml. I see a lot of resources on how to create stuff in the xaml.&lt;/p&gt;&lt;p&gt;Currently I&amp;#39;m trying to set the row height of a Grid to [x]. When I call:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var row = new RowDefinition();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; row.Height = new GridLength(150.0); &lt;/p&gt;&lt;p&gt;It sets the scale of the row to 150%. How would I set the actual height of the row, but not affect what is inside.&lt;/p&gt;&lt;p&gt;Also, is there a good resource (site, blog, book, etc) on how to do things in Code instead of xaml? I&amp;#39;m running into a lot of little things when trying to create dynamic elements/objects. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>