Silverlight 实现GlobalCalendar的国际化

Silverlight 实现GlobalCalendar的国际化,第1张

概述1)前台代码 <UserControl xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" x:Class="SilverlightApplication13.MainPage" xmlns="http://schemas.microsoft.com/winfx

1)前台代码

<UserControl xmlns:my="clr-namespace:System.windows.Controls;assembly=System.windows.Controls.Toolkit"  x:Class="SilverlightApplication13.MainPage"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:d="http://schemas.microsoft.com/Expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    mc:Ignorable="d"    d:DesignHeight="300" d:DesignWIDth="400">    <GrID x:name="LayoutRoot" Background="White">        <StackPanel>            <ComboBox x:name="CultureOptions" SelectionChanged="OnCultureChanged" HorizontalAlignment="left" margin="0 20 0 0">                <ComboBoxItem Content="arabic (Egypt)" Tag="ar-EG"/>                <ComboBoxItem Content="Chinese (SimplifIEd)" Tag="zh-Hans"/>                <ComboBoxItem Content="Czech (Czech Republic)" Tag="cs-CZ"/>                <ComboBoxItem Content="Danish (Denmark)" Tag="da-DK"/>                <ComboBoxItem Content="Dutch (Netherlands)" Tag="nl-NL"/>                <ComboBoxItem Content="English (United States)" Tag="en-US"/>                <ComboBoxItem Content="Finnish (Finland)" Tag="fi-FI"/>                <ComboBoxItem Content="french (France)" Tag="fr-FR"/>                <ComboBoxItem Content="German (Germany)" Tag="de-DE"/>                <ComboBoxItem Content="Greek (Greece)" Tag="el-GR"/>                <ComboBoxItem Content="Hebrew (Israel)" Tag="he-IL"/>                <ComboBoxItem Content="hindi (India)" Tag="hi-IN"/>                <ComboBoxItem Content="Hungarian (Hungary)" Tag="hu-HU"/>                <ComboBoxItem Content="Indonesian (Indonesia)" Tag="ID-ID"/>                <ComboBoxItem Content="Irish (Ireland)" Tag="ga-IE"/>                <ComboBoxItem Content="Italian (Italy)" Tag="it-IT"/>                <ComboBoxItem Content="Japanese (Japan)" Tag="ja-JP"/>                <ComboBoxItem Content="Korean (Korea)" Tag="ko-KR"/>                <ComboBoxItem Content="Malay (Malaysia)" Tag="ms-MY"/>                <ComboBoxItem Content="Mongolian (Cyrillic,Mongolia)" Tag="mn-MN"/>                <ComboBoxItem Content="norwegian,Bokmaringl (norway)" Tag="nb-NO"/>                <ComboBoxItem Content="Persian" Tag="fa-IR"/>                <ComboBoxItem Content="Polish (Poland)" Tag="pl-PL"/>                <ComboBoxItem Content="Portuguese (Brazil)" Tag="pt-BR"/>                <ComboBoxItem Content="Romanian (Romania)" Tag="ro-RO"/>                <ComboBoxItem Content="Russian (Russia)" Tag="ru-RU"/>                <ComboBoxItem Content="Spanish (Mexico)" Tag="es-MX"/>                <ComboBoxItem Content="Swedish (Sweden)" Tag="sv-SE"/>                <ComboBoxItem Content="Thai (Thailand)" Tag="th-TH"/>                <ComboBoxItem Content="Turkish (Turkey)" Tag="tr-TR"/>                <ComboBoxItem Content="Ukrainian (Ukraine)" Tag="uk-UA"/>                <ComboBoxItem Content="VIEtnamese (VIEtnam)" Tag="vi-VN"/>            </ComboBox>            <my:GlobalCalendar name="CulturedCalendar" />        </StackPanel>    </GrID></UserControl>

2)后台代码

using System;using System.Collections.Generic;using System.linq;using System.Net;using System.windows;using System.windows.Controls;using System.windows.documents;using System.windows.input;using System.windows.Media;using System.windows.Media.Animation;using System.windows.Shapes;using System.Globalization;namespace SilverlightApplication13{    public partial class MainPage : UserControl    {        public MainPage()        {            InitializeComponent();            CultureOptions.Selectedindex = 0;        }        /// <summary>        /// 当ComboBox变更选择后修改GlobalCalendar的现实语言        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private voID OnCultureChanged(object sender,SelectionChangedEventArgs e)        {            ComboBoxItem selectedComboBoxItem = CultureOptions.SelectedItem as ComboBoxItem;            CultureInfo culture = new CultureInfo(selectedComboBoxItem.Tag.ToString());            CulturedCalendar.CalendarInfo = new CultureCalendarInfo(culture);        }    }}
总结

以上是内存溢出为你收集整理的Silverlight 实现GlobalCalendar的国际化全部内容,希望文章能够帮你解决Silverlight 实现GlobalCalendar的国际化所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1063319.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存