void CtlDispositionRender_VMuktiEventCampaignID(object sender, VMuktiEventArgs e) { try { //MessageBox.Show("Event Called" + e._args[0].ToString()); Int64 CampID = Int64.Parse(e._args[0].ToString()); cnvDispoButtons.Children.Clear(); //GetAll() function to get data related to campaignID and Disposition List objDispColl = ClsDispositionRenderCollection.GetAll(CampID); double top = 5; double left = 5; for (int i = 0; i < objDispColl.Count; i++) { Button btnDisp = new Button(); btnDisp.Content = objDispColl[i].DespositionName; btnDisp.Tag = objDispColl[i].ID.ToString(); btnDisp.FontSize = 14; btnDisp.Width = 90; btnDisp.Height = 25; //btnDisp.HorizontalAlignment = "Center"; //btnDisp.Margin = new Thickness(left, top, 0, 0); btnDisp.SetValue(Canvas.TopProperty, top); btnDisp.SetValue(Canvas.LeftProperty, left); btnDisp.Click += new RoutedEventHandler(btnDisp_Click); cnvDispoButtons.Children.Add(btnDisp); if (i == 0) { left = left + 100; } else { if (i % 2 == 0) { if (i == 2) { left = left + 100; } else { left = left + 100; } } else { if (i == 1) { top = top + 30; left = left - 100; } else { top = top + 30; left = left - 100; } } } } } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "CtlDispositionRender_VMuktiEventCampaignID()", "CtlDispositionRender.xaml.cs"); } }