当前位置: 首页>>代码示例>>C#>>正文


C# TextBlock.SetResourceReference方法代码示例

本文整理汇总了C#中System.Windows.Controls.TextBlock.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# TextBlock.SetResourceReference方法的具体用法?C# TextBlock.SetResourceReference怎么用?C# TextBlock.SetResourceReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.TextBlock的用法示例。


在下文中一共展示了TextBlock.SetResourceReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PageHeader

        public PageHeader()
        {
            Brush brush = new SolidColorBrush(Colors.DarkGray);
            brush.Opacity = 0.60;

            this.Background = brush;

            Border frameBorder = new Border();
            frameBorder.BorderBrush = Brushes.Gray;
            frameBorder.BorderThickness = new Thickness(2);

            DockPanel panelMain = new DockPanel();
            panelMain.Margin = new Thickness(5, 5, 5, 5);
            panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            txtText = new TextBlock();
            txtText.FontSize = 32;
            txtText.Margin = new Thickness(5, 0, 0, 0);
            txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
            txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelMain.Children.Add(txtText);

            frameBorder.Child = panelMain;

            this.Content = frameBorder;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:27,代码来源:PageHeader.cs

示例2: Add

        public static void Add(Grid grid, string label, Binding value, int row, string labelStyle, string inputStyle, int startColumn)
        {
            int column = startColumn;
            if (label != "")
            {
                TextBlock labelElement = new TextBlock();
                labelElement.Style = App.Instance.Resources[labelStyle] as Style;
                labelElement.SetResourceReference(TextBlock.TextProperty, label);
                labelElement.VerticalAlignment = VerticalAlignment.Center;
                labelElement.Margin = new Thickness(column > 0 ? 5 : 0, 0, 0, 5);

                grid.Children.Add(labelElement);
                Grid.SetColumn(labelElement, column);
                Grid.SetRow(labelElement, row);
                column += 1;
            }

            System.Windows.Controls.TextBox inputElement = new System.Windows.Controls.TextBox();
            inputElement.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputElement.Margin = new Thickness(column > 0?5:0, 0, 0, 5);
            if (inputStyle != "")
            {
                Style s = App.Instance.Resources[inputStyle] as Style;;
                if (s.TargetType == typeof(System.Windows.Controls.TextBox))
                    inputElement.Style = s;
            }
            inputElement.SetBinding(System.Windows.Controls.TextBox.TextProperty, value);

            grid.Children.Add(inputElement);
            Grid.SetColumn(inputElement, column);
            Grid.SetRow(inputElement, row);
        }
开发者ID:hamada147,项目名称:ModAPI,代码行数:32,代码来源:TextField.cs

示例3: PageFleetRoute

        public PageFleetRoute(FleetAirliner airliner)
        {
            InitializeComponent();

            this.Airliner = airliner;

            InitializeComponent();

            StackPanel panelRoute = new StackPanel();
            panelRoute.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageFleetRoute","1000");

            if (this.Airliner.HasRoute)
            {
               panelRoute.Children.Add(createRoutesInfo());
               panelRoute.Children.Add(createFlightInfo());

                if (this.Airliner.Airliner.Airline == GameObject.GetInstance().HumanAirline) panelRoute.Children.Add(createFlightButtons());
            }
            else panelRoute.Children.Add(txtHeader);

            this.Content = panelRoute;
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:28,代码来源:PageFleetRoute.xaml.cs

示例4: PageAirportsStatistics

        public PageAirportsStatistics()
        {
            InitializeComponent();

            StackPanel panelStatistics = new StackPanel();
            panelStatistics.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1001";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageAirportsStatistics", txtHeader.Uid);

            panelStatistics.Children.Add(txtHeader);

            lbAirports = new ListBox();
            lbAirports.ItemTemplate = this.Resources["AirportItem"] as DataTemplate;
            lbAirports.Height = 500;
            lbAirports.ItemContainerStyleSelector = new ListBoxItemStyleSelector();

            panelStatistics.Children.Add(lbAirports);

            //GameTimer.GetInstance().OnTimeChanged += new GameTimer.TimeChanged(PageAirportsStatistics_OnTimeChanged);

            //this.Unloaded += new RoutedEventHandler(PageAirportsStatistics_Unloaded);

            this.Content = panelStatistics;

            showAirports();
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:31,代码来源:PageAirportsStatistics.xaml.cs

示例5: PageAirlinePilots

        public PageAirlinePilots(Airline airline)
        {
            this.Airline = airline;

            InitializeComponent();

            StackPanel panelPilots = new StackPanel();
            panelPilots.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1001";
            txtHeader.Margin = new Thickness(0, 0, 0, 0);
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageAirlinePilots", txtHeader.Uid);
            panelPilots.Children.Add(txtHeader);

            ContentControl ccHeader = new ContentControl();
            ccHeader.ContentTemplate = this.Resources["PilotsHeader"] as DataTemplate;
            ccHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            panelPilots.Children.Add(ccHeader);

            lbPilots = new ListBox();
            lbPilots.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbPilots.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbPilots.ItemTemplate = this.Resources["PilotItem"] as DataTemplate;
            lbPilots.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;
            panelPilots.Children.Add(lbPilots);

            this.Content = panelPilots;

            showPilots();
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:34,代码来源:PageAirlinePilots.xaml.cs

示例6: ShowOptionsWindow

        public static bool ShowOptionsWindow( FrameworkElement ChatControl, RatChat.Core.ConfigStorage ChatConfigStorage )
        {
            ChatOptionsWindow cow = new ChatOptionsWindow();
            var data = ChatControl.Tag as Tuple<RatChat.Core.IChatSource, string>;

            var configs = (from a in ConfigValueAttribute.GetAttribute(data.Item1.GetType())
                           orderby a.Caption
                           select a).ToArray();

            for (int j=0; j<configs.Length; ++j ) {
                cow.OptionsGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30.0) });

                // add text,
                TextBlock text = new TextBlock() { Text = configs[j].Caption };
                text.SetResourceReference(TextBlock.StyleProperty, "ConfigText");

                cow.OptionsGrid.Children.Add(text);
                Grid.SetRow(text, j);

                // add textbox
                UIElement val = null;

                if (configs[j].IsPasswordInput) {
                    val = new PasswordBox() { Tag = data.Item1.ConfigPrefix + configs[j].Name, Margin = new Thickness(2) };
                    ((PasswordBox)val).Password = (string)ChatConfigStorage.GetDefault(data.Item1.ConfigPrefix + configs[j].Name, configs[j].DefaultValue);
                } else {
                    val = new TextBox() { Tag = data.Item1.ConfigPrefix + configs[j].Name, Margin = new Thickness(2) };
                    ((TextBox)val).Text = (string)ChatConfigStorage.GetDefault(data.Item1.ConfigPrefix + configs[j].Name, configs[j].DefaultValue);
                }

                cow.OptionsGrid.Children.Add(val);
                Grid.SetRow(val, j);
                Grid.SetColumn(val, 1);
            }

            bool? ret = cow.ShowDialog();
            if (ret.HasValue && ret.Value) {
                // save
                for (int j = 0; j < cow.OptionsGrid.Children.Count; ++j) {
                    TextBox val = cow.OptionsGrid.Children[j] as TextBox;
                    if (val != null) {
                        string name = val.Tag as string;
                        ChatConfigStorage[name] = val.Text;
                    } else {
                        PasswordBox pb = cow.OptionsGrid.Children[j] as PasswordBox;
                        if (pb != null) {
                            string name = pb.Tag as string;
                            ChatConfigStorage[name] = pb.Password;
                        }
                    }
                }

                return true;
            }

            return false;
        }
开发者ID:JustOxlamon,项目名称:Sc2tvChatPub,代码行数:57,代码来源:ChatOptionsWindow.xaml.cs

示例7: PageAirportTraffic

        public PageAirportTraffic(Airport airport)
        {
            this.Airport = airport;

            InitializeComponent();

            StackPanel panelTraffic = new StackPanel();
            panelTraffic.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtPassengerHeader = new TextBlock();
            txtPassengerHeader.Uid = "1001";
            txtPassengerHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtPassengerHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtPassengerHeader.FontWeight = FontWeights.Bold;
            txtPassengerHeader.Text = Translator.GetInstance().GetString("PageAirportTraffic", txtPassengerHeader.Uid);
            panelTraffic.Children.Add(txtPassengerHeader);

            ListBox lbPassengerDestinations = new ListBox();
            lbPassengerDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbPassengerDestinations.ItemTemplate = this.Resources["DestinationItem"] as DataTemplate;
            lbPassengerDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100)/2;

            var destinations = from a in Airports.GetAllActiveAirports() orderby this.Airport.getDestinationPassengerStatistics(a) descending select a;

            foreach (Airport a in destinations.Take(20))
                lbPassengerDestinations.Items.Add(new KeyValuePair<Airport,long>(a,this.Airport.getDestinationPassengerStatistics(a)));

            panelTraffic.Children.Add(lbPassengerDestinations);

            TextBlock txtCargoHeader = new TextBlock();
            txtCargoHeader.Margin = new Thickness(0, 10, 0, 0);
            txtCargoHeader.Uid = "1002";
            txtCargoHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtCargoHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtCargoHeader.FontWeight = FontWeights.Bold;
            txtCargoHeader.Text = Translator.GetInstance().GetString("PageAirportTraffic", txtCargoHeader.Uid);
            panelTraffic.Children.Add(txtCargoHeader);

            ListBox lbCargoDestinations = new ListBox();
            lbCargoDestinations.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbCargoDestinations.ItemTemplate = this.Resources["DestinationItem"] as DataTemplate;
            lbCargoDestinations.MaxHeight = (GraphicsHelpers.GetContentHeight() - 100) / 2;

            var cargoDestinations = from a in Airports.GetAllActiveAirports() orderby this.Airport.getDestinationCargoStatistics(a) descending select a;

            foreach (Airport a in destinations.Take(20))
                lbCargoDestinations.Items.Add(new KeyValuePair<Airport, double>(a, this.Airport.getDestinationCargoStatistics(a)));

            panelTraffic.Children.Add(lbCargoDestinations);

            this.Content = panelTraffic;
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:52,代码来源:PageAirportTraffic.xaml.cs

示例8: PageAirlineSubsidiaries

        public PageAirlineSubsidiaries(Airline airline, StandardPage parent)
        {
            this.PageParent = parent;
            this.Airline = airline;

            InitializeComponent();

            StackPanel panelSubsidiaries = new StackPanel();
            panelSubsidiaries.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtSubsidiariesHeader = new TextBlock();
            txtSubsidiariesHeader.Uid = "1001";
            txtSubsidiariesHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtSubsidiariesHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtSubsidiariesHeader.FontWeight = FontWeights.Bold;
            txtSubsidiariesHeader.Text = Translator.GetInstance().GetString("PageAirlineSubsidiaries", txtSubsidiariesHeader.Uid);

            panelSubsidiaries.Children.Add(txtSubsidiariesHeader);

            lbSubsidiaryAirline = new ListBox();
            lbSubsidiaryAirline.ItemTemplate = this.Resources["SubsidiaryItem"] as DataTemplate;
            lbSubsidiaryAirline.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbSubsidiaryAirline.MaxHeight = GraphicsHelpers.GetContentHeight() - 100;

            showSubsidiaries();

            panelSubsidiaries.Children.Add(lbSubsidiaryAirline);

            WrapPanel panelButtons = new WrapPanel();
            panelButtons.Visibility = this.Airline.IsHuman && !(this.Airline is SubsidiaryAirline) && this.Airline.Money>100000 ? Visibility.Visible : Visibility.Collapsed;
            panelButtons.Margin = new Thickness(0,5,0,0);

            panelSubsidiaries.Children.Add(panelButtons);

            Button btnCreate = new Button();
            btnCreate.Uid = "200";
            btnCreate.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnCreate.Height = Double.NaN;
            btnCreate.Width = Double.NaN;
            btnCreate.Content = Translator.GetInstance().GetString("PageAirlineSubsidiaries",btnCreate.Uid);
            btnCreate.Click+=new RoutedEventHandler(btnCreate_Click);
            btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            panelButtons.Children.Add(btnCreate);

            if (this.Airline.IsHuman)
                panelSubsidiaries.Children.Add(createTransferFundsPanel());

            this.Content = panelSubsidiaries;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:50,代码来源:PageAirlineSubsidiaries.xaml.cs

示例9: PageAirlineFacilityMaintenance

        public PageAirlineFacilityMaintenance(AirlineFacility facility)
        {
            this.AirlinersToMaintain = new List<FleetAirliner>();
            this.AirlineFacility = facility;
            this.Classes = new List<AirlinerClass>();

            InitializeComponent();

            StackPanel facilityPanel = new StackPanel();
            facilityPanel.Margin = new Thickness(10, 0, 10, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1001";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PageAirlineFacilityMaintenance", txtHeader.Uid);

            facilityPanel.Children.Add(txtHeader);

            ContentControl ccHeader = new ContentControl();
            ccHeader.ContentTemplate = this.Resources["FleetHeader"] as DataTemplate;
            ccHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            facilityPanel.Children.Add(ccHeader);

            ListBox lbAirliners = new ListBox();
            lbAirliners.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbAirliners.ItemTemplate = this.Resources["AirlinerItem"] as DataTemplate;
            lbAirliners.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;

            foreach (FleetAirliner airliner in GameObject.GetInstance().HumanAirline.DeliveredFleet)
                lbAirliners.Items.Add(airliner);

            facilityPanel.Children.Add(lbAirliners);
            facilityPanel.Children.Add(createClassesPanel());
            facilityPanel.Children.Add(createButtonsPanel());

            StandardContentPanel panelContent = new StandardContentPanel();

            panelContent.setContentPage(facilityPanel, StandardContentPanel.ContentLocation.Left);

            base.setContent(panelContent);

            base.setHeaderContent(this.AirlineFacility.Name);

            showPage(this);
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:48,代码来源:PageAirlineFacilityMaintenance.xaml.cs

示例10: SimpleUIUsingResourceDictionary

        public SimpleUIUsingResourceDictionary()
        {
            var stack = new StackPanel();
            Content = stack;

            var textBlock = new TextBlock();
            textBlock.SetResourceReference(TextBlock.StyleProperty, SimpleResourceDictionary.TextBlockStyleKey);
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
            stack.Children.Add(textBlock);

            var local = textBlock.GetValue(TextBlock.StyleProperty);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("LstName")); //purposefully misspelled
            stack.Children.Add(textBlock);
        }
开发者ID:ssethi,项目名称:TestFrameworks,代码行数:16,代码来源:SimpleUIUsingResourceDictionary.cs

示例11: insertSettings

        private void insertSettings()
        {
            var landscapeTab = new TabItem();
            var tabHeader = new TextBlock { Text = "Landscape" };
            tabHeader.SetResourceReference(Control.StyleProperty, "TabHeaderTextStyleKey");
            landscapeTab.Header = tabHeader;
            landscapeTab.Content = new LandscapeView
            {
                DataContext = LandscapeViewModel.Instance,
                Margin = KCVApp.ViewModelRoot.Content is StartContentViewModel ? new Thickness(10, 9, 10, 9) : new Thickness(10, 0, 10, 0)
            };

            var settingsTab = (from view in KCVUIHelper.KCVContent.FindVisualChildren<TabControl>()
                               where view.DataContext is SettingsViewModel
                               select view).First();
            settingsTab.Items.Add(landscapeTab);
        }
开发者ID:xiaoqi0326,项目名称:KCV.Landscape,代码行数:17,代码来源:LandscapeExtention.cs

示例12: PopUpAirlinerClassConfiguration

        public PopUpAirlinerClassConfiguration(AirlinerClass aClass)
        {
            InitializeComponent();

            this.AirlinerClass = aClass;

            this.Title = new TextUnderscoreConverter().Convert(aClass.Type.ToString()).ToString();

            this.Width = 400;

            this.Height = 200;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            StackPanel panelClassFacilities = new StackPanel();

            TextBlock txtHeader = new TextBlock();
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = string.Format("{0}", new TextUnderscoreConverter().Convert(aClass.Type, null, null, null));

            panelClassFacilities.Children.Add(txtHeader);

            lbFacilities = new ListBox[Enum.GetValues(typeof(AirlinerFacility.FacilityType)).Length];

            int i = 0;
            foreach (AirlinerFacility.FacilityType type in Enum.GetValues(typeof(AirlinerFacility.FacilityType)))
            {
                AirlinerFacility facility = aClass.GetFacility(type);

                lbFacilities[i] = new ListBox();
                lbFacilities[i].ItemContainerStyleSelector = new ListBoxItemStyleSelector();
                lbFacilities[i].ItemTemplate = this.Resources["FleetFacilityItem"] as DataTemplate;

                panelClassFacilities.Children.Add(lbFacilities[i]);

                i++;

            }
            panelClassFacilities.Children.Add(createButtonsPanel());

            this.Content = panelClassFacilities;

            showFacilities();
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:46,代码来源:PopUpAirlinerClassConfiguration.xaml.cs

示例13: PanelPilot

        public PanelPilot(PagePilots parent, Pilot pilot)
        {
            this.ParentPage = parent;
            this.Pilot = pilot;

            InitializeComponent();

            StackPanel panelPilot = new StackPanel();

            TextBlock txtHeader = new TextBlock();
            txtHeader.Uid = "1001";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PanelPilot", txtHeader.Uid);

            panelPilot.Children.Add(txtHeader);

            ListBox lbPilotInformation = new ListBox();
            lbPilotInformation.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbPilotInformation.ItemContainerStyleSelector = new ListBoxItemStyleSelector();

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot","1002"), UICreator.CreateTextBlock(this.Pilot.Profile.Name)));
            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1003"), UICreator.CreateTextBlock(this.Pilot.Profile.Birthdate.ToShortDateString())));
            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1004"), UICreator.CreateTownPanel(this.Pilot.Profile.Town)));

            ContentControl lblFlag = new ContentControl();
            lblFlag.SetResourceReference(ContentControl.ContentTemplateProperty, "CountryFlagLongItem");
            lblFlag.Content = new CountryCurrentCountryConverter().Convert(this.Pilot.Profile.Town.Country);

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1005"), lblFlag));

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1006"), UICreator.CreateTextBlock(this.Pilot.EducationTime.ToShortDateString())));
            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1007"), UICreator.CreateTextBlock(this.Pilot.Rating.ToString())));
               // lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1008"), UICreator.CreateTextBlock(string.Format("{0:C}", ((int)this.Pilot.Rating) * 1000))));

            double pilotBasePrice = GameObject.GetInstance().HumanAirline.Fees.getValue(FeeTypes.GetType("Pilot Base Salary"));//GeneralHelpers.GetInflationPrice(133.53);<

            lbPilotInformation.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PanelPilot", "1008"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(((int)this.Pilot.Rating) * pilotBasePrice).ToString())));

            panelPilot.Children.Add(lbPilotInformation);

            panelPilot.Children.Add(createButtonsPanel());

            this.Content = panelPilot;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:46,代码来源:PanelPilot.xaml.cs

示例14: AddFields

        /// <summary>
        /// Adds the fields.
        /// </summary>
        private void AddFields()
        {
            ChkRemember.IsChecked = _displayPreferencesViewModel.RememberSorting;

            var index = 0;

            var currentValue = _displayPreferencesViewModel.SortBy ?? string.Empty;

            foreach (var option in _sortOptions.Keys)
            {
                var optionValue = _sortOptions[option];

                var radio = new RadioButton { GroupName = "Options" };

                radio.Margin = new Thickness(0, 25, 0, 0);

                var textblock = new TextBlock { Text = option };

                textblock.SetResourceReference(StyleProperty, "TextBlockStyle");

                radio.Content = textblock;

                if (string.IsNullOrEmpty(_displayPreferencesViewModel.SortBy))
                {
                    radio.IsChecked = index == 0;
                }
                else
                {
                    radio.IsChecked = currentValue.Equals(optionValue, StringComparison.OrdinalIgnoreCase);
                }

                radio.Tag = optionValue;
                radio.Click += radio_Click;

                PnlOptions.Children.Add(radio);

                index++;
            }

            RadioAscending.IsChecked = _displayPreferencesViewModel.DisplayPreferences.SortOrder ==
                                       SortOrder.Ascending;

            RadioDescending.IsChecked = _displayPreferencesViewModel.DisplayPreferences.SortOrder ==
                               SortOrder.Descending;
        }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:48,代码来源:SortWindow.xaml.cs

示例15: PanelNewRoute

        public PanelNewRoute(PageRoutes parent)
        {
            this.Classes = new Dictionary<AirlinerClass.ClassType, RouteAirlinerClass>();
            this.CargoPrice = 10;

            var query = from a in AirlinerTypes.GetTypes(delegate(AirlinerType t) { return t.Produced.From < GameObject.GetInstance().GameTime; })
                        select a.Range;

            this.MaxDistance = query.Max();

            this.ParentPage = parent;

            this.Margin = new Thickness(0, 0, 50, 0);

            TextBlock txtHeader = new TextBlock();
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Text = Translator.GetInstance().GetString("PanelNewRoute", "201");
            this.Children.Add(txtHeader);

            WrapPanel panelRouteType = new WrapPanel();

            rbPassenger = new RadioButton();
            rbPassenger.GroupName = "RouteType";
            rbPassenger.Content = Translator.GetInstance().GetString("PanelNewRoute", "1005");
            rbPassenger.Checked += rbRouteType_Checked;
            rbPassenger.Tag = Route.RouteType.Passenger;
            panelRouteType.Children.Add(rbPassenger);

            rbCargo = new RadioButton();
            rbCargo.Margin = new Thickness(10, 0, 0, 0);
            rbCargo.GroupName = "RouteType";
            rbCargo.Content = Translator.GetInstance().GetString("PanelNewRoute", "1006");
            rbCargo.Tag = Route.RouteType.Cargo;
            //rbCargo.IsEnabled = false;
            rbCargo.Checked += rbRouteType_Checked;
            panelRouteType.Children.Add(rbCargo);

            this.Children.Add(panelRouteType);

            panelRouteInfo = new StackPanel();
            this.Children.Add(panelRouteInfo);
            //rbPassenger.IsChecked = true;
        }
开发者ID:pedromorgan,项目名称:theairlineproject-cs,代码行数:45,代码来源:PanelNewRoute.cs


注:本文中的System.Windows.Controls.TextBlock.SetResourceReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。