public void Button_Click(object sender, RoutedEventArgs e) { string InputPath = "null"; ItemReader itemreader = new ItemReader(); using (OpenFileDialog dialog = new OpenFileDialog()) { if (System.Windows.Forms.DialogResult.OK == dialog.ShowDialog()) { InputPath = /*System.IO.Path.GetDirectoryName(*/ dialog.FileName /*)*/; } } ItemList mylist = itemreader.Load(InputPath); foreach (Item item in mylist.Items) { System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox(); System.Windows.Controls.Label label = new System.Windows.Controls.Label(); checkBox.Content = item.Name.ToString(); label.Content = item.UnlockRequirement.ToString(); label.Content = item.Description.ToString(); sdn.ItemNameStackPanel.Margin = new Thickness(0, 0, 0, 0); sdn.ItemDataStackPanel.Margin = new Thickness(0, 0, 0, 0); sdn.ItemNameStackPanel.Children.Add(checkBox); sdn.ItemDataStackPanel.Children.Add(label); mybox.Add(checkBox); //mylabel.Add(label); } }
private string GetRecipientsFromStackPanel() { string recipientList = ""; for (int i = 0; i < recipientStackPanel.Children.Count; i++) { System.Windows.Controls.Label label = (System.Windows.Controls.Label)recipientStackPanel.Children[i]; recipientList += @"," + label.Content.ToString(); } string finalList = recipientList.Remove(0, 1); return(finalList); }
private void BtnParcourir_Click(object sender, RoutedEventArgs e) { f.FolderBrowserDialog fbdChemin = new f.FolderBrowserDialog(); if (fbdChemin.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtChemin.Text = fbdChemin.SelectedPath; DirectoryInfo diDossier = new DirectoryInfo(fbdChemin.SelectedPath); foreach (FileInfo item in diDossier.GetFiles()) { c.Label lblItem = new c.Label() { Content = item.Name, Width = 120 }; lblItem.MouseDoubleClick += LblItem_MouseDoubleClick; stkFichier.Children.Add(lblItem); } } }