void CreateModuleItem(AccordionItem AcorItems, ServiceAuthenInitialize.CsDesktopItem moduleItem, StackPanel bodyPanel) { StackPanel panel = new StackPanel(); panel.Height = Double.NaN; panel.Width = Double.NaN; panel.Background = new SolidColorBrush(Colors.Red); //panel.b= new Thickness(0, 0, 0, 1); panel.Background = new SolidColorBrush(Color.FromArgb(250, 74, 74, 74)); //ligne ou se trouve le carré ou se trouve icone de menu gauche AcorItems.Background = new SolidColorBrush(Color.FromArgb(250, 74, 74, 74)); AcorItems.FontSize = 13; AcorItems.FontWeight = FontWeights.Bold; AcorItems.Foreground = new SolidColorBrush(Colors.White); AcorItems.BorderBrush = new SolidColorBrush(Color.FromArgb(200, 102, 102, 102)); AcorItems.BorderThickness = new Thickness(0, 0, 0, 1); //Image Image image = new Image(); image.Height = 20; image.Name = moduleItem.Process; image.Margin = new Thickness(50, 8, 50, 5); image.Width = 20; image.Stretch = Stretch.Fill; string urlImage = "/Galatee.ModuleLoader;component/Image/" + moduleItem.Process + ".png"; string defaultImage = "/Galatee.ModuleLoader;component/Image/mnuToolbox.png"; Uri uriImage; try { uriImage = new Uri(urlImage, UriKind.Relative); } catch (Exception ex) { uriImage = new Uri(defaultImage, UriKind.Relative); string error = ex.Message; } image.Source = new BitmapImage(uriImage); image.SetValue(Canvas.LeftProperty, 42.0); image.SetValue(Canvas.TopProperty, 15.0); image.MouseLeftButtonDown += new MouseButtonEventHandler(button_Click); panel.Children.Add(image); //TextBlock TextBlock textb = new TextBlock(); textb.Text = moduleItem.LIBELLE_FONCTION; textb.SetValue(Canvas.LeftProperty, 30.0); textb.SetValue(Canvas.TopProperty, 86.0); textb.Foreground = new SolidColorBrush(Colors.Red); bodyPanel.Children.Add(panel); }
void CreateModuleItem(AccordionItem AcorItems, ServiceAuthenInitialize.CsDesktopItem moduleItem, StackPanel bodyPanel) { try { StackPanel panel = new StackPanel(); panel.Height = Double.NaN; panel.Width = Double.NaN; panel.Background = new SolidColorBrush(Colors.White); panel.HorizontalAlignment = HorizontalAlignment.Left; panel.Orientation = Orientation.Vertical; //panel.Background = new SolidColorBrush(Colors.LightGray); //Image Image image = new Image(); image.Height = 45; image.Name = moduleItem.Process; image.Margin = new Thickness(50, 8, 8, 5); image.Width = 45; image.Stretch = Stretch.Fill; string urlImage = "/Galatee.Silverlight;component/Image/" + moduleItem.NOM + ".png"; string defaultImage = "/Galatee.Silverlight;component/Image/mnuToolbox.png"; Uri uriImage; try { uriImage = new Uri(urlImage, UriKind.Relative); } catch (Exception ex) { uriImage = new Uri(defaultImage, UriKind.Relative); Message.Show(ex, "CreateModuleItem"); //string error = ex.Message; } image.Source = new BitmapImage(uriImage); image.SetValue(Canvas.LeftProperty, 42.0); image.SetValue(Canvas.TopProperty, 15.0); image.MouseLeftButtonDown += new MouseButtonEventHandler(button_Click); panel.Children.Add(image); //TextBlock TextBlock textb = new TextBlock(); textb.Text = moduleItem.LIBELLE_FONCTION; textb.SetValue(Canvas.LeftProperty, 30.0); textb.SetValue(Canvas.TopProperty, 86.0); textb.Foreground = new SolidColorBrush(Colors.Red); panel.Children.Add(textb); //Button button = new Button(); //button.Content = moduleItem.LIBELLE_FONCTION; //button.SetValue(Canvas.LeftProperty, 30.0); //button.SetValue(Canvas.TopProperty, 86.0); //button.Name = moduleItem.NOM; //// add event delegate //button.Click += new RoutedEventHandler(button_Click); //panel.Children.Add(button); bodyPanel.Children.Add(panel); //AcorItems.Content = bodyPanel; } catch (Exception ex) { throw ex; } }