Example #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;
            text.FontSize = 16;

            panel.Children.Add(text);
            LanguageSelector.Items.Add(c);
        }
Example #2
0
        void AddLanguage(Configuration.Language language)
        {
            var c = new ComboBoxItem
            {
                Style = Application.Current.FindResource("ComboBoxItem") as Style
            };
            var panel = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };

            c.Content = panel;

            if (language.ImageStream != null)
            {
                var i   = new Image();
                var 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);
            }

            var text = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                Text     = language.Resource["LangName"] as String,
                FontSize = 16
            };

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