 |
|
 |
Hey all
Im new to silverlight, just want to know how to embed or add silverlight to an existing ASP.net project. In flash you only use the following code:
<object width="871px" height="400px"> <param name="aa" value="aa.swf" /> <embed src="flash\aa.swf" width="871px" height="400px"></embed> </object>
Can someone tell me how do it with Silverlight.
Thanx
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Ok, I appreciate the strong data orientated design of Silverlight (WPF) and the power of Binding etc, but after all it is UI technology...
The omission of even basic UI support really baffles me, simple things like: - looping over controls, did they assume my data object is going to represent all the attributes of my presentation layer? (Try setting custom values for the GroupName of radio buttons after using Binding to generate them) - the TreeView's SelectedItem attribute gives you the data object bound to the Tree Node that is selected, how do I get (or set) the selected Node? And I need to get the parent Node of the selected Node?
Did Microsoft assume that we wouldn't need to do these things, or didn't they have enough time to include them (were they more intent on selling than building?) I understand Silverlight is a compact framework and that they had to omit certain things, but to omit basic UI functionality from a UI framework???
____________________________________________________________ Be brave little warrior, be VERY brave
|
|
|
|
 |
|
 |
Adriaan Davel wrote: looping over controls, did they assume my data object is going to represent all the attributes of my presentation layer?
It's still present - you use the VisualTreeHelper class to iterate over the controls.
Adriaan Davel wrote: the TreeView's SelectedItem attribute gives you the data object bound to the Tree Node that is selected, how do I get (or set) the selected Node? And I need to get the parent Node of the selected Node?
Have a read of this[^] thread.
Adriaan Davel wrote: I understand Silverlight is a compact framework and that they had to omit certain things, but to omit basic UI functionality from a UI framework
That's not the case - you need to learn the new way of doing things that is behind Silverlight and WPF. You can't really use the same techniques you used in WinForms/ASP.NET; it's a totally different way of working. Once you get your head round it, it makes a lot of sense - and is actually very, very powerful.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
Pete O'Hanlon wrote: It's still present - you use the VisualTreeHelper class to iterate over the controls.
Sure, but why need another class to iterate over a collection (surely there is a collection that holds the controls)? Now I need to get the .Count and then for over it, like languages from the olden days... Why can't I LINQ to get controls etc...
Pete O'Hanlon wrote: Have a read of this[^] thread.
Read it, VERY messy code to achive very simple functionality...
Pete O'Hanlon wrote: really use the same techniques you used in WinForms/ASP.NET;
The fact of the matter is that the functional requirements are the same, but the technical ability to fulfill the requirements has been stripped and now needs lots of work arounds and looping...
Pete O'Hanlon wrote: and is actually very powerful
I agree, if you do things the way that they work, if you need something slightly different, you have no power at all and need to loop and hack...
I don't mean to be negative, but I am very disappointed...
____________________________________________________________ Be brave little warrior, be VERY brave
|
|
|
|
 |
|
 |
Adriaan Davel wrote: Sure, but why need another class to iterate over a collection (surely there is a collection that holds the controls)?
Primarily because there are actually two trees (well, in WPF there are), the logical and the visual tree. Which one would you like to loop over?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
I would say that you should probably read about MVVM and how we can write tests from ViewModel? Writing in code-behind is not so common in WPF/Silverlight. UI and logic seperation is important.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
 |
|
 |
Hi all.
I want to create a Silverlight graph that plots data by getting them from a database when the user enters them from the UI. I hope to use LinQ to SQL to do this. I am also using Visual Studio 2008 .NET 3.5, SQL Server 2008.
Can anyone help me? Feel free to ask me for any additional info that might be of help.
|
|
|
|
 |
|
 |
I'm sorry, but you're unlikely to find anybody willing to write the amount of code for you that you seem to be requesting. You have all the right ideas, but it seems that you lack the SL capability/inclination here - if that's the case, start off with a smaller application and get your head round that at first.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
Well, I'm not really requesting anyone to write the full code for me, but rather give me a head start and guide me along. Sad to say, it's quite an urgent and rushed project for me, so I don't really have time to "get my head round silverlight" anymore.
|
|
|
|
 |
|
 |
burger87 wrote: it's quite an urgent and rushed project for me, so I don't really have time to "get my head round silverlight"
Ouch. Right, let's start by working out what you do know - out of the list you provided, what are you comfortable with? For instance, are you thoroughly versed in LINQ?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
I'm glad you're helping. Another big ouch, I'm versed in neither. I'm only slightly comfortable in C# and that's it. I've done a few tutorials on creating simple charts and a simple Silverlight application that gets data from WCF using LinQ to SQL.
|
|
|
|
 |
|
 |
burger87 wrote: I've done a few tutorials on creating simple charts and a simple Silverlight application that gets data from WCF using LinQ to SQL.
So, you've got the basics there. If you are using the Silverlight Toolkit charts, this page has some useful samples to demonstrate how to populate the charts[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
Oh I see. However, if I'm not mistaken these charts' values are hard-coded right?
|
|
|
|
 |
|
 |
burger87 wrote: Oh I see. However, if I'm not mistaken these charts' values are hard-coded right?
That's right. You can retrieve these values using LINQ. You need to put them into a dictionary, as in:var result = mySql.OrderBy(res => res.Value) .ToDictionary( res => res.Name, res => res.FloatValue); This example supposes that your key string name is called Name and your numeric value is stored in your database as FloatValue. All you need do then is apply this with the DataContext, e.g. chart.DataContext = result;
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
What is a dictionary and DataContext?
|
|
|
|
 |
|
|
 |
|
 |
Thanks for the links SunilUrs, but I forgot to mention that I cannot use Visifire for my project.
|
|
|
|
 |
|
 |
You might want to check out my blog post here[^]. You might find it illuminating.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
Hey Pete(is that your name?). A very big thanks for the sample code. It's very helpful. A few questions that needs clarification.
1) What is an ObservableCollection? Is it similar to a container? 2) For the DataContext, what do you mean by "bind to the collection"? Do you mean the ObservableCollection? 3) If I use the database's values to update the chart instead of using ObservableCollection, do I still need to make use of ObservableCollection? 4) What is MVVM? I'm interested. Does it help my situation in any case?
Hope you can shed some extra light there. 
|
|
|
|
 |
|
 |
burger87 wrote: Hey Pete(is that your name?).
Yes.
burger87 wrote: 1) What is an ObservableCollection? Is it similar to a container?
An ObservableCollection is a specialist collection that's designed to support data binding in WPF and Silverlight. Basically, when you add or remove an item from this collection the collection notifies the binding engine that values have been added or removed.
burger87 wrote: For the DataContext, what do you mean by "bind to the collection"? Do you mean the ObservableCollection?
Yes.
burger87 wrote: If I use the database's values to update the chart instead of using ObservableCollection, do I still need to make use of ObservableCollection?
Seriously, use the collection - create a model that encapsulates your database values and put this into your collection. Don't cause problems for yourself; use the tools available.
burger87 wrote: What is MVVM? I'm interested. Does it help my situation in any case?
MVVM is a pattern - it stands for Model-View-ViewModel. Basically this pattern is designed to work with Silverlight and WPF. Google it to find out about it, and read the samples and articles (I have a WPF version here[^]).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes. My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
 |
|
 |
Hi,
In my silverlight application I need to call a WCF service. I have to pass a string variable as input and return an array list from the WCF service.
If anyone have any idea how to call WCF service or pass perameters to the WCF service please reply me.
Thanks in Advance.
|
|
|
|
 |
|
 |
If you are using Visual Studio 2008, you need to install Silverlight Tool for Visual Studio. You will see the Silverlight Project template in "New Project" dialog after installation.
1. Chose Silverlight Application and check the check box for ASP.NET project for hosting Silverlight.
2. Add Silverlight-Enabled WCF service in ASP.NET
3. Write a method with parameter and return the array list that you want.
4. Build the ASP.NET project
5. Add this service as a service reference in Silverlight project.
6. then, you will be able to see the method that you write in Silverlight-Enabled WCF service
Hope it helps.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
 |
|
|
 |