SharePoint自带Silverlight WebPart中文输入问题处理

    开发了SilverLight程序在SharePoint上使用,为了省事,就直接用了SharePoint自带的WebPart。可是在用的时候发现TextBox中文不能输入,网上一查,居然说2.0/3.0版本有这样的问题,不知道4.0有没有解决呢。在网上找到的解决办法都是直接去修改HTML里Object对象的Windowless属性,是在
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
   <param name="windowless" value="false"/>

    可是在SharePoint中的SilverLight WebPart属性设置面板里找不到该属性。用Reflector看了下这个WebPart,其实是有个属性叫WindowlessMode的,只不过特性里没加可视化显示出来。
    SharePoint自带Silverlight WebPart中文输入问题处理

    那这样可以通过导出导入的方式来处理。以下解决方式:
我们先在一个页面上添加一个SilverLight WebPart,设置好需要的路径和属性,然后依照以下方式操作。
一、首先在WebPart设置中高级里把"导出模式"设置为"导出全部数据",如图

SharePoint自带Silverlight WebPart中文输入问题处理
二、导出WebPart文件

SharePoint自带Silverlight WebPart中文输入问题处理
三、修改上面保存的WebPart文件中的属性WindowlessMode为False,WebPart中XML内容如下

View Code
   
     
< webParts >
< webPart xmlns ="http://schemas.microsoft.com/WebPart/v3" >
< metaData >
< type name ="Microsoft.SharePoint.WebPartPages.SilverlightWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,

PublicKeyToken=71e9bce111e9429c"
/>
< importErrorMessage > 无法导入此 Web 部件。 </ importErrorMessage >
</ metaData >
< data >
< properties >
< property name ="HelpUrl" type ="string" />
< property name ="AllowClose" type ="bool" > True </ property >
< property name ="ExportMode" type ="exportmode" > All </ property >
< property name ="Hidden" type ="bool" > False </ property >
< property name ="AllowEdit" type ="bool" > True </ property >
< property name ="Direction" type ="direction" > NotSet </ property >
< property name ="TitleIconImageUrl" type ="string" />
< property name ="AllowConnect" type ="bool" > True </ property >
< property name ="HelpMode" type ="helpmode" > Modal </ property >
< property name ="CustomProperties" type ="string" null ="true" />
< property name ="AllowHide" type ="bool" > True </ property >
< property name ="Description" type ="string" > A web part to display a Silverlight application. </ property >
< property name ="CatalogIconImageUrl" type ="string" />
< property name ="MinRuntimeVersion" type ="string" null ="true" />
< property name ="ApplicationXml" type ="string" />
< property name ="AllowMinimize" type ="bool" > True </ property >
< property name ="AllowZoneChange" type ="bool" > True </ property >
< property name ="CustomInitParameters" type ="string" > windowless="false" </ property >
< property name ="Height" type ="unit" > 600px </ property >
< property name ="ChromeType" type ="chrometype" > Default </ property >
< property name ="Width" type ="unit" />
< property name ="Title" type ="string" > Silverlight Web Part </ property >
< property name ="ChromeState" type ="chromestate" > Normal </ property >
< property name ="TitleUrl" type ="string" />
< property name ="Url" type ="string" > /_LAYOUTS/ClientBin/xxxxx/xxxxxxx.xap </ property >
< property name ="WindowlessMode" type ="bool" > False </ property >
</ properties >
</ data >
</ webPart >
</ webParts >


四、上传修改后的WebPart文件

SharePoint自带Silverlight WebPart中文输入问题处理
五、插入修改后的web部件,试一试,输入中文OK了。

SharePoint自带Silverlight WebPart中文输入问题处理
另外再说下那个CustomInitParameters,自定义初始化参数,设置方式需要处理分隔符,"key1=value1,key2=value2,key3=value3"。是应用程序级的初始化参数,可以是背景、颜色等,可以在程序中获得使用。

你可能感兴趣的:(silverlight)