Hello Code Project,
I have a requirement in Silverlight, that If a TextBox[ContentControl] have validation error, then the appearence should be like a red wavy line, with a tool tip of error content. If it is possible , please help me with a sample silverlight application..
Correct, you have to go with silverlight only. Prism is one of the popular MVVM frame work. there no mandatory that you need to use all of these things, You can create your app with out them as well. But Building WPF/Silverlight is advisable.
Strictly speaking, PRISM is not an MVVM framework. Yes, it has some MVVM features, but it is better regarded as an application composition framework. If the OP didn't build his original app with PRISM then he's got a whole host of work in trying to convert it into PRISM.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
Yes we can go with xbap application even i too thought that also.
But my basic requirement of converting this wpf to an web application is that
1) I am connecting centralized sql server with ado.net which have image data type also, so when i connect to the centralized database and fetch the data and also image am getting huge delay on getting the same.
I even asked a question on C# discussion forum on the same and they suggested me to go with image storage in physical drive and use web browser control to access the image. And instead of ado.net can use webservices.
But my thought is that if we create an web application and host the application in same server where the data base server exists will solve my problem. Thats the reason i wanted to convert into web application.
2) According to my understanding xbap application is that, when we trigger that it will download the exe to the local desktop through browser and run from local machine. If that is the case once again i hope i will be getting the same issue. If its is not the case i hope xbap would be the right option for me.
Please correct my if my understanding is wrong.
2)if i go with WCF or entity with local
servers wont it help me regarding handling data and image data types with
Sorry but I dont understand your conecrn
No, Actually my issue was to handle the image through centralized server. So i thought to host the web application and db server in the same machine. if i use ado.net it will work fine and also its working fine now. But if i go for wcf or entity model, will it also take more time to give me data having image data type?
Abhinav S wrote:
Hema Bairavan wrote:
3) And regarding XBAP, Will it
download the xbap file exe to the local machine and it will work from local
desktop like windows application like that it will connect db via internet only
Yes, an xbap file will be downloaded to you machine.
Ok thanks for your reply. So, xbap will behave like local windows application, if i use ado.net to connect centralized sql server to get data having image data type it will also take time like windows application???
i hope with this reply our conversation will come to end
By your requirement, changing the application to a webapplication (be it by web forms, silverlight or XBAP) will not solve your problem. In fact, you will only lose yet more performance.
If your application is loading images from a centralized server and that is making things slow, I think your problem is on the transfer rate of those images. If you can change your application to do a local cache of the images, you will only need to go to the server the first time (the first download) of that image, and later you can use it locally.
Surely it is good to use some mechanism to check if the image needs to be updated or not (considering the server image changes), but that's all.
Doing an web page, you will:
Have to send the application throgh tcp/ip + the images through tcp/ip. Even if the webserver does a local access, the client will use tcp/ip to get to the webserver.
The only advantage is that browsers deal with the cache for you (but considering you will need to rewrite the application, it is not a real advantage).
For the item 2. All web applications do almost the same. HTML applications can have code that executes on the server, but they will send such HTML to the client. That HTML can then asks for postbacks or call a web-service, but it executes locally (on the client).
WPF (as XBAP) and Silverlight are like the HTML code in the sense they execute on the client machine, but for anything else, they should call the webserver (a service call... WCF, for example). So, I am sure your problem is not there.
It all depends how you created your WPF app, and what resources it uses; e.g. does it use the local file system, are you using custom printing, etc. Is it written using an MVVM framework, or is it written using code behind?
There is no magic bullet - we can't give you a hard and fast figure I'm afraid.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
No, You cannot "convert" to a web application. This would be a massive re-work.
Silverlight however would be a very good way to get your application to be viewed in the web as this is in effect an application plugin hosted in a browser. You do not need Prism or any other framework but I would strongly recommend using one as it stops you re-writing many boiler plate code or functionality that is already written and tested.
With WPF and Silverlight, you can create an application and then share the same code across your platforms. I would recommend downloading the Prism framework. In there the Stock_RI application has a couple of samples, one being cross platform development / Multi target.
Without ratting through your code I would guess that you are passing in the row object into the query and it is turning the object into a string(). You should be passing in the SelectedValue from the combo not the SelectedItem.
Never underestimate the power of human stupidity
If you are using bytes to store a byte array, this[^] would give you an idea on what you need to do to display a random image.
Note that all API's may not be available in WP so you may have to improvise to achieve similar results.
I am working on a WPF application. The application uses Infragistics controls such as Ribbon Controls and XamDockManager. It has a File Menu wherein I have provided a Save menu item to save the items on the canvas to a file. On click of Save button, Save Dialog opens to provide the File name and file is saved at the defined location.
The saving process is quite time consuming and in order to show something to the user, I have used the WaitCursor.
I have used a class similar to the one mentioned(UiServices.ShowWaitCursor) in the below thread.
public void WriteToFile(string fileName)
This works fine, if we just save the things on the canvas into a file. However, if fails in the below scenario.
The application has a canvas where I display some UI elements. On double click of the UI element, we launch a Windows form in the Infragistic ContentPane.
We have a modeless dialog opened and perform File -> Save and provide a file name, the cursor stays indefinitely. It goes only once we click on the Canvas. The DispatcherTimer_Tick is fired only when we click on the Canvas which resets the cursor.
The DispatcherPriority is ApplicationIdle.
Another observation is, this happens only when we open the Save dialog through the File -> Save. It works fine if we open the Save dialog through Ctrl + S key combinations.
Is there a way I can debug the non firing of DispatcherTimer.Tick event or any other way to handle this?
I created a simple WPF application and it works fine in that.
///<summary>/// Interaction logic for MainWindow.xaml
///</summary>publicpartialclass MainWindow : Window
privatevoid button1_Click(object sender, RoutedEventArgs e)
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
form.Height = 200;
form.Width = 400;
form.TopMost = true;
privatevoid MenuItem_Click(object sender, RoutedEventArgs e)
string fileName = SaveFileDialog();
// Create SaveFileDialog
Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
// Display SaveFileDialog by calling ShowDialog method
Nullable<bool> result = dlg.ShowDialog();
string filename = string.Empty;
// Get the selected file name
if (result == true)
// Open document
filename = dlg.FileName;
///<summary>/// Sets the busy state on the application.
/// Displays a wait cursor for long running tasks.
///<summary>/// A value indicating whether the UI is currently busy
///<summary>/// Sets the state as busy.
///<summary>/// Sets the state to busy or not busy.
///</summary>///<paramname="busy">if set to <c>true</c> the application is now busy.</param>privatestaticvoid SetBusyState(bool busy)
if (busy != _isBusy &&
Application.Current != null &&
Application.Current.Dispatcher != null)
_isBusy = busy;
Mouse.OverrideCursor = busy ? Cursors.Wait : null;
new DispatcherTimer(TimeSpan.FromSeconds(0), DispatcherPriority.ApplicationIdle, DispatcherTimer_Tick, Application.Current.Dispatcher);
///<summary>/// Handles the Tick event of the dispatcherTimer control.
///</summary>///<paramname="sender">The source of the event.</param>///<paramname="e">The <seecref="System.EventArgs"/> instance containing the event data.</param>privatestaticvoid DispatcherTimer_Tick(object sender, EventArgs e)
var dispatcherTimer = sender as DispatcherTimer;
if (dispatcherTimer != null)
I can't execute your code (I don't have those libraries you use), but can you use another priority?
I don't know... maybe you have an animation or similar that is never really letting the application become idle.
Note: Seeing your code, you don't need to use a DispatcherTimer. It is enough to do a Dispatcher.BeginInvoke to call your delegate. This will also guarantee that it will execute only once, as soon as all the messages (including the actual one) are processed. In fact, I think your problem is that you never started your timer.
Hopefully this will be a quick question to answer, but personally I'm not sure which way to go.
Firstly I'm using SL5, MVVM, MEF, EF. I have a person entity - the person entity has a collection of account entities, address entities and order entities.
In my view I am displaying a list of the people on the left with the corresponding lists on the right (accounts, addresses, orders). When the person is changed in the list I obviously want the lists on the right to update.
Obviously it would be inefficient to just include the lists in the domain service query using the .Include() operation as it will return ALL the people with ALL the related list entities. This is where my dilemma is - when I change the person do I either:
Load each of these lists separately, each with their own completed events where I populate the view lists. Which is basically three extra calls to the DB.
2. Call a different GetPeople query in the domain service where I pass in the current person ID and use the .Include() operation to include accounts, address and orders, but filter by the passed in PersonID. (i.e. return this.ObjectContext.People.Include("Accounts").Include("Addresses").Include("Orders").Where(p=>p.ID == PersonID);)
Can I integrate WPF application in web application??
I am working in a website, in this I want to integrate a small WPF application. Can i do this?? for eg... I wanna open login/signin popUp ("which is created in WPF") in my web application to enter the user in main page.
or we can say that in any tutorial webpage, I want to insert demo application of WPF application.
If it is possible please let me know, how i can do this.
I'm working on an WPF MVVM application. The data entry screen has to have all it's fields disabled until the user clicks "Add" or "Edit", and also the fields cannot become enabled if the user does not have rights to that field.
So, I would like to bind all IsEnabled properties in the XAML to a single method on the ViewModel. I would need to pass in a string value which is the 'key' of the field. Then in the VM would use the key to check the rights. The method would be something like
publicbool CanEnableField(string Key)
// if the form is in Add or Edit Mode, and the user has rights to the field, then
// return true, else false
A converter would probably not work because that class won't know about the VM and the form's mode (Add/Edit).
I could bind each field's IsEnabled to individual properties on the VM and handle all this in the getter, but that would be a lot of properties in the VM.
The best way is to have a bool Property in your VM, to which you caan bind the IsEnabled property of the relevant controls like this:-
publicbool CanEnableField(string Key)
// if the form is in Add or Edit Mode, and the user has rights to the field, then EnableControls = true
if (enableControls != value)
enableControls = value;