[Ironpython-users] Hosting ironpyhon in silverlight , get Couldnot add reference to assembly System.Windows.Controls error

zdong zdong at rliansoft.com
Thu Jul 28 18:42:58 CEST 2011


dear jimmy 

Acturally i want to create instance of StackPanel,TextBlock ect. That been widly known as silverlight standard framework element in system.windows.controls. If i directly use stackins=StackPanel() it's seems could not found StackPanel class . So that's way i want to import system.windows.controls namespace.

Now i had temply solved by this way ,Not the finally solution ,but i think this can help you understand what i'm try to do, thank you so much.

def AfterLoadData():------This function will been called by silverlight side when data been ready 
   QueryHistroyCriticalAlarm():
def QueryHistroyCriticalAlarm():
  SQLString="select * from use_alarms where store='%s' order by receiveddate desc"%(DM_SJ.Text)
  DBQuery('StoreQuery',SQLString)
def FormResult(Indentity,Dataset):
  if Indentity=='StoreQuery':
     AddHisList(Dataset)
def AddHisList(Dataset):
  Dataset.first()
  while Dataset.EOF()!=True:
    Row=CreateNewObject('StackPanel')   ----This CreateNewObject is defined in silverlight side, so i don't think this is right way ,i'm image can i use some way like this
                                                              Row=StackPanel() just like this. thanks jimmy
    ReceivedDate=CreateNewObject('TextBlock')
    ReceivedDate.Text=getFieldValue(Dataset,"ReceivedDate")
    ReceivedDate.Width=100;
    Row.Children.Add(ReceivedDate)
    EquipmentName=CreateNewObject('TextBlock')
  ......................
  ....................

2011-07-29 



发件人: Jimmy Schementi 
发送时间: 2011-07-28  20:53:14 
收件人: 曾东 
抄送: ironpython-users 
主题: Re: [Ironpython-users] Hosting ironpyhon in silverlight , get Couldnot add reference to assembly System.Windows.Controls error 
 
There is no System.Windows.Controls.dll that ships with Silverlight,
it is in the Silverlight SDK, meaning you must provide it in your
application's XAP file.
~Jimmy
2011/7/28 曾东 <zdong at rliansoft.com>:
> Hi,
>
>
>
> I use this code in silverlight to run a script define outer
>
>
>
>              var setup = new ScriptRuntimeSetup();
>
>              setup.HostType = typeof(BrowserScriptHost);
>
>              setup.LanguageSetups.Add(Python.CreateLanguageSetup(null));
>
>              setup.Options["SearchPaths"] = new string[] { string.Empty };
>
>              Runtime = new ScriptRuntime(setup);
>
>              Scope=Runtime.CreateScope();
>
>
>
>              engine = Runtime.GetEngine("Python");
>
>
>
>
>
>
>
> The python script has some code to import windows.controls but it failed
> with "Could not add reference to assembly System.Windows.Controls"
>
>
>
> import clr
>
> clr.AddReference('System.Windows.Controls')
>
> from  System.Windows.Controls import *
>
>
>
> Could you kindly give me some suggestion ,thanks
>
>
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
>
>
.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110729/382bf1b2/attachment.html>


More information about the Ironpython-users mailing list