|
pisanis wrote: I am of the understanding that Silverlight (any version) will need to call a WCF web service
You don't have to use WCF.
For example a plain old XML (POX) web service could be used. Silverlight
can bind directly to the returned XML or if necessary you could convert the
returned XML to an object or collection of objects using perhaps LINQ to XML.
*edit* Oops - drifted into WPF Land there
pisanis wrote: How do I go about gettings rows of information, like, a resultset from my database and into SL ?
pisanis wrote: once I get that dataset, I do not know how to return it to silverlight
There's a variety of ways to accomplish this.
If you choose to use WCF, you could return a collection of objects of a class that
represents a row of data. You would convert dataset rows to this collection of
objects, perhaps using LINQ to DataSet.
You may also want to look into .NET RIA Services, which is still in development and
will probably be officially part of .NET 4, but there is a preview version[^] available
which is now licensed to use live.
Mark Salsbery
Microsoft MVP - Visual C++
modified on Friday, August 7, 2009 1:30 PM
|
|
|
|
|
The most of your questions are already answered by our Codeproject Silverlight Experts.
I will just add one more point here.
If you really want to return the DataSet from Service then you may want to check-out the code written by one of our Silverlight community members. The link for that is here[^].
But returning the dataset from service is not a good idea but the most of .NET developers who are familiar with .NET 1.1 and 2.0 still prefer to use DataSet.
Another thing is that DataSet will not be supported in Silverlight.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I recently started learning Silverlight. While doing a sample code I got stuck with how to load Silverlight UserControl dynamically from the same .xap file. Imagine a scenario where we have two UserControl; Login and Reports. User would need to login to see the report page. On click of the Login button the Reports UserControl should be loaded and Login UserControl should be unloaded.
I was able to achieve this functionality by using delegate. I will try to explain the bit I have done to achieve this.
Declare a base class which inherits from the UserControl class. The base class will exposes a delegate to handle the dynamic loading of the usercontrol.
BaseUserControl.cs
namespace MyFirstSLApp
{
public delegate void ControlChangeHandler(object control, int ctrlId);
public class BaseUserControl : UserControl
{
public ControlChangeHandler OnContentChange;
}
}
Create a Login UserControland inherit it from the BaseUserControl class. Here we will implement the code to notify the subscriber for the UserControl change.
Login.xaml
<control:BaseUserControl xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input" x:Class="MyFirstSLApp.Login"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlnsBig Grin="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:control="clr-namespace:MyFirstSLApp"
Width="400" Height="200" >
<Grid x:Name="LayoutRoot" Background="White" Width="400">
<Grid x:Name="LoginLayout" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="User Id:" Grid.Column="0" Grid.Row="0" ></TextBlock>
<TextBox x:Name="txtUserId" Grid.Column="1" Grid.Row="0" ></TextBox>
<TextBlock Text="Password:" Grid.Column="0" Grid.Row="1"></TextBlock>
<PasswordBox x:Name="txtPassword" Grid.Column="1" Grid.Row="1"></PasswordBox>
<Button x:Name="btnLogin" Content="Login" Click="btnLogin_Click" Grid.Column="0" Grid.Row="2"></Button>
<!--<Button x:Name="btn" Content="Login" Grid.Column="3" Grid.Row="0"
Grid.ColumnSpan="2" Grid.RowSpan="2"></Button>-->
<TextBlock x:Name="txtError" Text="" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="4"></TextBlock>
</Grid>
<dataInput:ValidationSummary >
</dataInput:ValidationSummary>
</Grid>
</control:BaseUserControl>
Login.xaml.cs
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
if (OnContentChange != null)
OnContentChange(this, 1);
}
Note: Since we have inherited the Login control from BaseUserControl control, I have used control:BaseUserControl tag instead of UserControl tag. To enable the compiler to recognise BaseUserControl tag, add following entries to AssemblyInfo.cs file
[assembly: XmlnsDefinition("http://schemas.microsoft.com/client/2007", "MyFirstSLApp")]
Create a UserControl which will acts as the container for loading the controls dynamically.
Page.xaml
<UserControl x:Class="MyFirstSLApp.Page"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctrl="clr-namespace:MyFirstSLApp"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
</Grid>
</UserControl>
Note:Here the <Grid> control will act as a container. We can dynamically add the UserControls to its UIElementCollection. This gives us a flexibility to add or remove a control at runtime.
Finally subscribe the delegate in APP class. Here we will manipluate the Children collection of the Page Control to dynamically display UserControls.
App.xaml.cs
private void Application_Startup(object sender, StartupEventArgs e)
{
Page page = new Page();
Login login = new Login();
ContentChange(login);
page.LayoutRoot.Children.Add(login);
this.RootVisual = page;
}
public void ContentChange(BaseUserControl control)
{
control.OnContentChange += new ControlChangeHandler(control_OnContentChange);
}
void control_OnContentChange(object control, int ctrlId)
{
Page page = null;
switch (ctrlId)
{
case 1:
page = (Page)this.RootVisual;
page.LayoutRoot.Children.Clear();
Reports report = new Reports();
page.LayoutRoot.Children.Add(report);
ContentChange(report);
break;
case 2:
page = (Page)this.RootVisual;
page.LayoutRoot.Children.Clear();
Login login = new Login();
page.LayoutRoot.Children.Add(login);
ContentChange(login);
break;
}
}
AR
modified on Friday, August 7, 2009 7:21 AM
|
|
|
|
|
Friends we are creating application in WPf. Now the problem that i am facing right now is that my Application have too many child window. i want that when any child window is showed it should be right aligned with other child window and main window plus when we drag main window the child should also align with it i use an event location change and then iterate through childwindows of the main window and then change the location but is there any other proper way????
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
Why don't you hook each child window to an event that indicates that the parent window is being moved (or has moved)?
With a short google search I found (and you could have too) this:
http://stackoverflow.com/questions/926758/window-statechanging-event-in-wpf/928798[^]
I don't know if it will help you, but I'm neither emotionally nor financially invested in your finding an answer to your question, so you'll have to take over from here.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm sorry about bothering you with such noob question!
I'd like to start programming a simple raster drawing program for WPF with layers, etc. (something like paint.net) as a learning project.
Do you have any ideas where should I start? I've tried to find similar projects to look at for ideas on google but I couldn't.
What components and base classes are suitable to try?
|
|
|
|
|
0) Start Visual Studio
1) Click File | New... | Project...
2) On the left side of the subsequent dialog box, click "Windows"
3) On the right side, click "WPF Application"
4) At the bottom of that dialog, enter an entertaining, yet applicable name for your new project.
5) Click the OK button.
6) Next.... ah hell, I'm bored - you can take it from here.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Nice advice. I've done it. And now if you tell me how to draw pixels on the screen you'll be my God!
|
|
|
|
|
I only help those who help themselves.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I only help those who help themselves.
Yeah! "God helps those who help themselves" - I know that proverb!
What a senseless discussion! Not only you are not helping me but you are wasting my time by making me check your posts.
Thanks a lot!
P.S. You've missed your opportunity to make a good deed today and help yourself gather credits for the heaven and you've made an evil one. One day you'll have to answer for your sins!
|
|
|
|
|
Cristoff wrote: God helps those who help themselves
So, you're saying that John is God. Please don't - his ego will run rampant.
Cristoff wrote: P.S. You've missed your opportunity to make a good deed today and help yourself gather credits for the heaven and you've made an evil one. One day you'll have to answer for your sins!
Not a good way to get others to want to help you.
"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
|
|
|
|
|
|
John is now a god.
God will judge John for his sin of being John.
Recursion.
Universe suffers stack overflow.
Vista crashes.
Great, we are doomed.
|
|
|
|
|
I would help you further, but I have a somewhat acidic sense of humor, and I merely enjoy watching those who worship me struggle with their day-to-day problems. Then, just as things start going for the better for them, I randomly snatch away their pitiful life, reminding them of my presence. I always get a chuckle out of the surprised look on their faces.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I would help you further, but I have a somewhat acidic sense of humor, and I merely enjoy watching those who worship me struggle with their day-to-day problems. Then, just as things start going for the better for them, I randomly snatch away their pitiful life, reminding them of my presence. I always get a chuckle out of the surprised look on their faces.
I also have a sense of black humor. And I never refuse flaming. I like every opportunity to exercise my English.
I just don't think that it's appropriate to spam a serious forum.
|
|
|
|
|
Technically, it's impossible to spam when you're omnipotent.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I disagree. God is the biggest spammer of them all. He created man!
|
|
|
|
|
Cristoff wrote: I disagree. God is the biggest spammer of them all. He created man!
God only created a single man. That man in turn is responsible for the current mess we're in.
Todd Smith
|
|
|
|
|
Todd Smith wrote: God only created a single man. That man in turn is responsible for the current mess we're in.
That's exactly what a spammer does: he creates a software (for example) that produces all the spam mails. Do you think that the spammer writes all these mails by hand, I don't think so?
So did God before that: he made the ultimate spam and garbage producing creature - the man that is capable of self reproducing the ultimate dream of a spammer-god!
|
|
|
|
|
WPF is meant for vector graphics, not for bitmaps.
If you want to display a bitmap in WPF and need to be able to efficiently update it in memory, look at the WriteableBitmap[^] class.
If you want to render WPF vector contents onto a bitmap, take a look at RenderTargetBitmap[^].
|
|
|
|
|
Danke! The suggestion seems like a good idea! Thank you!
|
|
|
|
|
Hello,
"Applause" for Daniel Grunwald, who, imho, gave a considerate and appropriate response to the OP.
Given the OP's question was broad enough that you could see the earth's curvature in the distance ...
Still, imho, he responded with some "redeeming" sense of humour to the first rapier slash of JSOP.
I've voted all the (imho) sarcastic and needless posts #1 : this is a technical forum, not the lounge! And I've voted up the OP just for the sake of sheer contrariness.
Gentlemen and Gentlewomen, I ask you whether it benefits CodeProject as a whole to use the technical forums as a "dumping ground" for "interpersonal static" ?
Isn't it more valuable (I'm asking rhetorically) to just politely tell the OP that the question is so broad as to be off-topic, or unanswerable, or to suggest to OP that they do a search of the many technical articles on CP that have to with drawing, drawing surfaces, bitmaps, shapes, etc. in both WPF and WinForms ?
To those of you who wish to admire your "godliness" : I suggest you look in a mirror
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Anyone know of a free download for the Ribbon control? I'm also looking for some cool free icons that I can download and use in my WPF application?
|
|
|
|
|
|
I'm trying to port an application that heavily relies on the classes in the System.Web namespace (a lot of http requests and responses).
The problem is, I can't seem to find anything similar in Silverlight. Am I missing something, or is Silverlight that crippled? :S
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
|
|
|
|