|
But how does other commercial components work?like active comport.
|
|
|
|
|
Hello everyone
I have two images, image1 represent lunch and image2 represents dinner. When I run my application the image1 is displayed on main window.
How can I change image1 to image2 corresponding time of day (at run-time)?
For instance: lets say
from 12:00 to 17:00 I want my image1 to be displayed at main window, and
from 17:00 to 23:00 I want to display image2 at main window.
could someone please help me solve this problem, Hence: I'm new to WPF...
thanks in advance
kind regards
lapeci
|
|
|
|
|
Presumably you have a property representing the image to be displayed and bind your xaml to the property.
You then need a timer in your code (code behind or ViewModel). In the timers tick event you check the datetime.now and change the image property to the image you want to display.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello Mycroft Holmes
Thanks for replying to my question...
Is there any way you can help me with a sample code because I don't have a clue how to do it
I'm very new to wpf... thanks in advance.
kind regards
lapeci
|
|
|
|
|
Sorry, I don't do code, you are going to have to work it out! If you get stuck with something then come back and we will help.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am developing a paint application. I am using Canvas control as whiteboard.
I want to use InkCanvas kind of functionality in WPF canvas, means I want to draw a free hand shape on Canvas. How can I do this ? I also want to save in as *.JPG
Thanking You !!!
|
|
|
|
|
Fortunately for you, Code Project legend and all round good guy Sacha Barber wrote an article on this very topic here[^].
|
|
|
|
|
Thank you so much, but that samples uses InkCanvas control I want to use Canvas control
|
|
|
|
|
|
I have a WPF application using MVVMlight. I wanted to use a new WPF skin from a dll. I added a ResourceDictionary in the App.Xaml to the Application.Resources section as shown...
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Assembly;component/NewSkin.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Building it throws an error saying "Program does not contain a static 'Main' method suitable for an entry point". If I remove the ResourceDictionary entry, it compiles fine.
Found the following potential issues when I searched.
1. Has the "Build action" been set to "Application Definition" - yes, it is an existing project with the App.xaml build action set to "Application Definition"
2. Does the app.g.cs file exist - I checked the app.g.cs file. it does have a Main method
Additional information:
1. I am using Visual Studio 2010
2. I am also using MVVM Light. There is one other entry in the Application.resources section of App.xaml.
<!--Global View Model Locator-->
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
which is the ViewModelLocator for MVVMLight toolkit.
Appreciate any help!
|
|
|
|
|
Hello,
Ive created a dependency property:
class FrameworkElement : UIElement
{
public static readonly DependencyProperty NumberProperty;
public FrameworkElement() { }
static FrameworkElement()
{
FrameworkPropertyMetadata metadata =
new FrameworkPropertyMetadata(Double.NaN,
FrameworkPropertyMetadataOptions.AffectsMeasure);
NumberProperty = DependencyProperty.Register("Number",
typeof(Double),
typeof(FrameworkElement),
metadata,
new ValidateValueCallback(FrameworkElement.IsNumberValid));
}
public Double Number
{
set { SetValue(NumberProperty, value); }
get { return (Double)GetValue(NumberProperty); }
}
private static Boolean IsNumberValid(object value)
{
Double number = (Double)value;
if ((number < 0) || (number > 100))
return false;
return true;
}
}
and i added to it a validation callback.
When i set an out of range number to that proprty i get an:ArgumentException.
How can i do that instead of an exception the propertie will get some default value when i try to set out of range number?
Thanks
|
|
|
|
|
hi all
i want to use DirectShowLib.Dll(The .Net base dll) in
my Silverlight app.can anyone help me how do that?!!!
Thanks
|
|
|
|
|
|
Hai..
i am using a listbox where using mediaplayer as the list item. i am playing 5 videos simultaniously in 5 mediaplayer item, every video is a 10 sec video. i don't know how to loop all the videos.
Sample Code:
OpenFileDialog open = new OpenFileDialog();
open.Filter = AVI (*.avi)|*.avi;
open.ShowDialog();
MediaElement medi = new MediaElement();
medi.LoadedBehavior = MediaState.Play;
medi.UnloadedBehavior = MediaState.Stop;
medi.Source = new Uri(open.FileName);
medi.MediaEnded+=new RoutedEventHandler(medi_MediaEnded); ---> not working
menu.Items.Add(medi) ------> list box
|
|
|
|
|
Hi Everyone,
I have created a hot key screen scraper that works very well for windows application using win32 API. I need to do the same to a Silverlight Application that is hosted on a web. The goal is to allow reading data from the Silverlight web page automatically. I am able to get the handle to the browser window, but I'm not able to load the hidden data from the XAP object in the HTML page. I realize the XAP is just another zip file, but how do I get that loaded to a memory stream given the window handle for the browser?
Thanks a bunch in advance....
-Daniel
|
|
|
|
|
I was reading through posts such as this one on MSDN[^], and I was wondering why in MVVM, we constantly try to save 10 lines of code in the .xaml.cs class by adding 100 lines in the viewmodel or helper classes.
Can someone tell me the main benefit of taking such big hits in code size and readability to avoid putting code in the .xaml.cs file?
I would think that even if you do regular event handling in the .xaml.cs file, it still follows the textbook MVVM pattern (view knows viewmodel, viewmodel knows model, no other knowledge allowed).
|
|
|
|
|
I can see how keeping the business logic in the viewmodel makes sense, in which case doing normal event handling in the .xaml.cs file that calls a public method in the viewmodel would seem to suffice.
In the accepted answer in the MSDN thread I linked to, the answerer creates a static class (that the viewmodel is aware of) that specifically knows that the data is bound to a DataGrid (and not a Listview or a third-party data control). That sounds like a severe violation of the MVVM principle to me, in addition to being a pain in the butt to code and maintain.
However, I can't seem to find any examples of handling events that aren't the standard Command event (such as double-click, enter, or leave) elegantly without doing regular event handling in the xaml.cs file, which is frowned upon for some reason.
It feels like there is no real standard, and people are just juggling back and forth between competing bad practices and never really landing anywhere. I'm coding a bunch of WPF interfaces now, and I'd like me and my whole team to have a solid idea of what the best practice is.
|
|
|
|
|
Thanks; I'll read up on System.Windows.Interactivity.
|
|
|
|
|
You can hand over the xaml file to the styling / UI team while your developers can continue to code and build the code behind for that file.
|
|
|
|
|
The designers now can do their bit on the front end. The dev can do what they do best and then you end up with a good looking testable application (in a nutshell).
And, it looks cool!
|
|
|
|
|
Well, for someone who has started WPF stuff, MVVM, Commanding & Data Binding looks bit confusing because of the numerous articles on the Internet. You might have visit some of those articles and come to this point where you would like to know more about the MVVM. When I had started the WPF had the same issue that you currently facing.
The main advantages of the pure MVVM implementations are
1. Separation of concerns
2. Help out for Unit testing
3. Development can be carried out parallel
4. Tracing the changes/Impact and development is quite easy(this one is my favorite)
Implementing pure MVVM(not writing a single code of line communicating VM or M) is bit time consuming as you have to spend lot of time searching for the mechanism for communication e.g. double click events that you mentioned in your question above.
But believe me you will enjoy implementing it
To implement the Pure MVVM following points should be considered
1. Do not write single line of code communicating to the VM or Model
2. Though, View can contain the code lines related to GUI only. e.g. Adjusting some controls custom width/height on window size change, can go in main windows xaml.cs file as it has nothing to do with our VM and M. Its purely related to the View
3. If any controls needs to be referenced from the code behind, reference them from the App.xaml.cs file. App.xaml.cs, you can consider this as start up configuration. e.g. customizing the Title bar (showing the Title bar like Avast Antivirus check here) can go here.
4. Start the code from the App.xaml.cs file, configure your application here, like logging initialization, start up screen display, unhanded exception etc.
5. Inject the Model and View in the View model, this is best practices as view modes knows about view as well as model (know only at interfaces level)
6. Have a BaseVM class which will implement the INotifyPropertyChanged and derive your all Vm from this. This will help in eliminating repeated code
Hope this will help you get going
Happy Coding
|
|
|
|
|
The problem I have with MVVM is it is very difficult to implement multiple usercontrols on the same form. I like to have my ribbonbar as one user control, a sidepanel treeview control as another usercontrol, a tabcontrol as another usercontrol, and a statusbar of course as another usercontrol. I generally have a mainform that I place these on using <dockpanel> and <controls:ribbonbar dockpanel.dock="top"> etc. I've tried using caliburn micro to no avail as it will not display my controls even if I have no errors.
|
|
|
|
|
Dear friends...
Brief about my problem & Software:
I have developed a web based software using silverlight using c#. Its courier specific software. Here in one of the screen, I would get the data which tells me the count of consignments being delivered/not delivered.
This data, I would download as xls file.
PROBLEM : After downloading in the xls file, I want to click on one of the count (say delivered : 90). This should open up another screen where in displaying all the details of 90 consignments.
I just do not know how to achieve this through coding. Its as "PIVOT TABLE" in excel. where in user clicks and the data opens up in another sheet.
GUYS PLEASE HELP ME... If you need further help, please mail me : formulaone87@gmail(dot)com or post in this thread. I would revert you back...
Thank you
F1
modified 7-Jun-12 6:41am.
|
|
|
|
|
Your question shows such a dramatic lack of understanding that there is probably no way to help you until you have a deeper understanding of Silverlight/developing.
The only suggestion I can make is that you get a book and work through it from cover to cover, when you have gained some basic knowledge then try asking the question again, you won't need to!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ya I do underastand. I am a beginner... But you do understand my requirement.. Please help me the way it can be achieved...
I just want the way where in the data being downloaded from an application be opened as the way it works in excel file containing pivot data.
Your help is required very badly team.. Please help
|
|
|
|