Silverlight / WPF - WPF: Adding controls at dynamically - control width returns NaN

Asked By vivek P
06-Sep-10 06:41 AM
I want to add set of checkbox at runtime one by one in one column. So i am creating object and adding to wrappanel but width of controls is NaN so i am not able to set location(Y co ordinate) of next checkbox.

int lastheight = 10;

private void btnadd_Click(object sender, RoutedEventArgs e)

{

CheckBox chk_add = new CheckBox();

chk_add.MaxWidth = 100;

TextBlock tb_add = new TextBlock();

tb_add.MaxWidth = 100;
tb_add.TextWrapping = TextWrapping.Wrap;

tb_add.Text = "Here is long text so that text block will get split over two lines....... blah blah blah";

chk_add.Content=tb_add;

 

chk_add.Margin = new Thickness(10, lastheight, 0, 0);

wrapPanel1.Children.Add(chk_add);

lastheight += (int)chk_add.Width;

}

Can any any one have idea how can i tackle this issue.

  gao lili replied to vivek P
10-Sep-10 03:15 AM
We wholesle many styles of <a href=" http://blog.bodybuilding.com/">bodybuilding</a>.They are very comfotable and easy to macth with all kinds of clothes.
We wholesle many styles of <a href= http://blog.bodybuilding.com/>bodybuilding</a>.They are very comfotable and easy to macth with all kinds of clothes.
[url= http://blog.bodybuilding.com/]bodybuilding[/url] are very suitable for men who like doing sport.
  gao lili replied to gao lili
10-Sep-10 03:15 AM

We wholesle many styles of bodybuilding.They are very comfotable and easy to macth with all kinds of clothes.

Create New Account
help
Silverlight 2 RC0 Doing Data Part VIII : Using the Threadpool Silverlight 2 implements the ThreadPool, which can be useful for parallel operations on background threads. Here required crossdomain.xml or clientaccesspolicy.xml file at the root of the site, enabling a Silverlight client to make cross-domain calls to get data. My UI has a DataGrid, a winfx / 2006 / xaml" Width = "700" Height = "500" > <Grid x:Name = "LayoutRoot" Background = "White" > <TextBlock Text = "Silverlight Threadpool Sample" VerticalAlignment = "Top" Width = "500" HorizontalAlignment = "Center" FontSize = "20" / > <my:DataGrid x:Name = "dgFeeds DataTemplate> <StackPanel Margin = "5 5 5 5" Width = "600" Height = "75" > <TextBlock Text = "{Binding Description}" TextWrapping = "Wrap" Width = "600" FontSize = "10" / > < / StackPanel> < / DataTemplate> < / my:DataGrid.RowDetailsTemplate> < / my:DataGrid> <TextBox x:Name = "Text1" HorizontalAlignment = "Left" VerticalAlignment = "Bottom" Padding = "5" Width = "200" Text = "Silverlight" > < / TextBox> <Button Width = "150" Height = "25" HorizontalAlignment = "Right" VerticalAlignment = "Bottom" Content = "Search!" Click = "Button_Click" > < / Button public Page() { InitializeComponent(); bigFeed = new SyndicationFeed(); itemList = new List<SyndicationItem> (); } private void Button_Click( object sender, RoutedEventArgs e) { string srch = Text1.Text; feedsCount = feedUrls.Length; foreach ( string url in feedUrls) { ThreadPool.QueueUserWorkItem us to aggregate the results quite easily. While there are other ways to use the Silverlight ThreadPool class, you will probably find in your travels that this is the most common
how to insert run time generated textbox value into database. . ? Silverlight / WPF Hi all I generated three textbox at run time. i want to insert its ColumnProperty, 1); string s = tBox.Text; grid1.Children.Add(tBox); private void button1_Click(object sender, RoutedEventArgs e) { string result_insert = "insert into tLAB_TestResult values('" + PatientBooked.id + "', '" +tBox.Text+ "', '" + testid + "')"; } TextBox TextBox() { tBox VerticalAlignment.Top; tBox.Foreground = new SolidColorBrush(Colors.Black); tBox.Background = new SolidColorBrush(Colors.White); tBox.TextWrapping = TextWrapping.NoWrap; tBox.IsReadOnly = false; / / tBox.Text = AllBeds[J].ToString(); / / count.ToString(); / / +"<br> " + AllPlots[i].ToString
Silverlight client object model in sharepoint 2010 hi, i have a code like static void Main Line Item from Child {0} : {1} " , desc, text); }     } Console .Read(); i want this code in silverlight client object model please help me The following example shows how to create a list string siteUrl = " http: / / MyServer / sites / MySiteCollection / MyWebSite "; public MainPage() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; ListCollection collList = oWebsite.Lists; oList oList.AddItem(new ListItemCreationInformation()); oListItem["Title"] = "My new item"; oListItem["Body"] = "This is my new Silverlight item."; oListItem.Update(); clientContext.Load(oList, list = > list.Title); clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed); } private void Show("Request failed. " + args.Message + " \ n" + args.StackTrace); } } } check this link for more insight into SilverLight Client Object Model http: / / msdn.microsoft.com / en-us / library / ee538971.aspx#Y400 Simple example of using a Silverlight application in SharePoint 2010, using the new SharePoint 2010 Client Object Model. I will also how to use the new SharePoint 2010 tools in Visual Studio 2010 to package the Silverlight application for deployment. Note that I will not be getting into the details of creating a flashy (no pun intended) UI in Silverlight – i will just create a very simple UI with a list box and a text
SilverLight What is SilverLight, its concept, why to use it and how to use it What is Silverlight? Silverlight is a new cross-browser, cross-platform implementation of the .NET Framework for building and browsers, including Microsoft Internet Explorer, Mozilla Firefox, Apple Safari, Opera. The plugin required to run Silverlight is very small in size hence gets installed very quickly. It is combination of different platform that allows you to select tools and the programming language you want to use. Silverlight integrates seamlessly with your existing Javascript and ASP.NET AJAX code to complement functionality which you have already created. Silverlight aims to compete with Adobe Flash and the presentation components of Ajax . It also competes with Sun Microsystems' JavaFX, which was launched a few days after Silverlight. Currently there are 2 versions of Silverlight: Silverlight 1.0 : Silverlight 1.0 consists of
silverlight and wpf difference if one person has gain master in silverlight than wiil this help him in learning wpf Hi Malik, WPF has a more advanced and mature XAML support than Silverlight. Silverlight used to be called (WPF / E) and is a subset of the WPF XAML design well and other items. WPF is hardware accelerated and supports things like GPU shaders which Silverlight 2 does not. Silverlight 2 does have the VisualStateManager inside Blend 2, which I think WPF needs an add on and a tweak to work. I think that is the only case where Silverlight 2 XAML was / is slightly ahead of WPF's. Here is a link on XAML us / library / cc917841(VS.95).aspx Here is a good article on MSNMAG about designing Silverlight / WPF apps together and sharing code: http: / / msdn.microsoft.com / en-us / magazine / cc895632.aspx