Exemple #1
0
        void AddLanguage(Configuration.Language language)
        {
            ComboBoxItem c = new ComboBoxItem();
            c.Style = Application.Current.FindResource("ComboBoxItem") as Style;
            StackPanel panel = new StackPanel();
            panel.Orientation = Orientation.Horizontal;
            c.Content = panel;

            if (language.ImageStream != null)
            {
                Image i = new Image();
                BitmapImage img = new BitmapImage();
                img.BeginInit();
                img.StreamSource = language.ImageStream;
                img.EndInit();
                i.Source = img;
                i.Margin = new Thickness(0, 0, 10, 0);

                panel.Children.Add(i);
            }

            TextBlock text = new TextBlock();

            text.VerticalAlignment = VerticalAlignment.Center;
            text.Text = language.Resource["LangName"] as String;

            panel.Children.Add(text);
            LanguageSelector.Items.Add(c);
        }