|
Nakul,
What I've always done, is add a WinForm Window to my project and when the WPF code launches any report, is to Show the WinForm window with the report viewer control. Just pass whatever report information is necessary.
This way, when the Report View Control works in WPF, you just replace the window with the same name.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Ramble
I've been looking at using the View-ViewModel-Model pattern in WPF & Siverlight for some small apps.
Often I find the ViewModel is very similar to the Model in my simple apps, but maybe just a few more view specific properties.
Wrapping my Model class in a ViewModel is sometimes problematic.
Say we have an Employee Class and we want to add a IsSelected property so it can be used in the View.
If we create a ViewModel Employee class and add the new IsSelected property all is okay, except....
If any other class, say Company.GetEmployees() returns a List<employee>, then I have to write another wrap to enumerate through the results and transform Employee to ViewModelEmployee.
Possible solution?
Use Extension Methods (don't have Extension Properties)
Then I can just add GetIsSelected, SetIsSelected methods to the base Employee class.
Using an ObjectDataProvider (don't think this is in Silverlight) we can access the GetIsSelected method, using Bindings similar to properties.
At least that's what I'm thinking haven't tried this out yet!
/Ramble
|
|
|
|
|
|
Great answer Karl. Like it.
|
|
|
|
|
|
I've got a class library in which I added a service reference to a WCF service. VS automatically added an app.config file into the class lib which is fine with me.
Unfortunately, I always get the following error trying to use the service reference:
"Could not find default endpoint element that references contract 'ServiceReference1.IService1' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."
I've checked all the configuration the endpoint settings are well aligned with the auto generated proxy for the service.
I noticed that if I add the same service reference into a web app and copy the serviceModel config over it just works fine in my web app. So that's why I assumed that there must be some issues with the class lib in conjunction with wcf references?
Am I wrong?
Any help very much appreciated!
Cheers,
M
|
|
|
|
|
Ok I will answer that question by myself... lol
I just realized that it is a stupid idea to have a standard app.config file in a class library since the config file is usually considered for an app domain.
So VS shouldn't allow that option to add a WCF reference to a class library and even worse add an app.config file into the class lib leading the dev believe that everything is going to work out fine.
As soon as I added the ServiceModel config section to the config file of the consuming app (web or win) everything works just fine.
Certainly, people might argue with me and telling me that I could implement my own proxy and config. But in this case I believe MS should give the dev some hints.
Cheers,
M
|
|
|
|
|
I often use an app.config file in class libraries. This allows the class library to be responsible for its own resources, as well as allowing the classes in the library to access those resources in a strongly typed manner.
To make the resources available to the executing assembly that references such a class library, I add a line to the executing assembly's app.config <configsections> element, creating a section to hold the class library's settings. Of course, you must then recreate the class library's sections within the executing assembly's app.config, and keep them synchronized whenever changes are made.
Obviously, this is not optimal because you must maintain the settings in two different files, but I am not sure of a better way to do it if you want to access those resources within the class library (in a strongly typed manner).
I would love to hear how other Devs out there handle this scenario.
Keith
|
|
|
|
|
Well, we normally do something like this[^].
|
|
|
|
|
Hi,
I faced the same error.
But it got fixed when added following references in the client application.
System.Runtime.Serialization
System.ServiceModel .
Cheers,
RumYeah
|
|
|
|
|
i tried to upload my website designed using silverlight. But it wasn't working. although it wasn't shownin ny error msg. does anyone know how to upload that???
|
|
|
|
|
Are you using IIS or Apache? If you are using IIS or some other web server, you need to config MIME ext for xap extension..
|
|
|
|
|
Hi,
I want to start silverlight based website. how can I proceed further.
What can I do for that.
I have silverlight controls(GOA).How can I add the controls in VS.NET IDE.
Thanks
sjs4u
|
|
|
|
|
|
Hello, I don't recommend you to use GOA controls. Those controls are more like window-ish kinda controls. If you are using Silverlight 2, there are a lot of controls that you can use.
|
|
|
|
|
I need to work on WPF. So i need to develop some small projects on WPF? how can I create WPF User control ? Can any one help me in this scenario?
|
|
|
|
|
|
Thank you Pete. And can you help in developing applications in WPF?
I've a small requirement.
I have one image that is in 2D. I want to shape it as 3D and then it should be rotated to all directions.. Can you help me in this scenario of how to develop this application?
|
|
|
|
|
|
Thank you Jani. And can you help in developing applications in WPF?
|
|
|
|
|
|
Hi all,
i fell a bit confuse about how save a FlowDocument to Xps.
I create FlowDocument "flowdocumentsample2.xaml" i set up it Build Action:Content ,Copy to Output Directory: Copy Always
FlowDocument doc = Application.LoadComponent(u) as FlowDocument;
FlowDocRdr.Document = doc;
Now i don't know the code how save the FLowDocument in the FlowDocumentReader to Xps .Im a new one in the WPF and my purpose of this feature is to create a report add new features to complete it but now i get stuck in this step .
DO you have any advice,suggestion to help me to understand better and work out my request.
Thanks so much .
Have a nice day.
BestRegards,
GooBye
|
|
|
|
|
We use a variation of this:
private void SaveToXps(string fileName, RichTextBox rtb)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("fileName");
}
if (Path.GetExtension(fileName).ToLower() != ".xps")
{
fileName += ".xps";
}
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
TextRange range = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
range.Save(fileName, DataFormats.XamlPackage);
}
}
|
|
|
|
|
HI Pete,
sorry for my later however i tried your advice
so i can save the document in .Xps but after i cannot read/open that file with the XPSViewer.exe...
XPSViewer got error:
I saw the file that i saved it is not empty but i don't why i cannot open it .
i used this code :"cannot open the document.The document may be not be a valid XPS document"
private void SaveToXps(string fileName)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentNullException("fileName");
}
if (System.IO.Path.GetExtension(fileName).ToLower() != ".xps")
{
fileName += ".xps";
}
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
TextRange range = new TextRange(FlowDocRdr.Document.ContentStart, FlowDocRdr.Document.ContentEnd);
range.Save(stream, DataFormats.XamlPackage);
}
}
and for the button this one:
private void SaveToXps_1(object sender, RoutedEventArgs e)
{
SaveToXps("C:\\test1.xaml");
}
Do you have any suggest for this error..
However thanks for your support.
Have a fun.
Bye
|
|
|
|
|
Hi
I have two diffrent Windows .. Window1.xaml and Window2.xaml .
Window2.xaml has a button and 3 text boxes.. and Window1.xaml has 3 textboxes aswell. I want to make it so that when i a user types is anything in Window2.xaml and then click the button it will copy the text and paste the text in Window1.xaml automatically ..
how can i achive this.. ?
Thanks in advance
|
|
|
|