First I want to say that I'm quite new to WPF and XAML programming languages.
I'm currently trying to make a calendar (Custom Control) in WPF and to be onest I'm not quite sure how to approach this task. Although I've searched all over the internet I couldn't find a pleasing answer. This is the link where I've found some ideas:
I've chosen this approach because will be very easy to create the design and the effects on MouseOver and MouseClick events, but the main problem with it is that I'm not sure on how I can create the logistics of the Calendar:
1st problem: How to bind the data between all of this Controls in order to create the logistics of a basic Calendar;
2nd problem: If the appoiment is longer than 1 day is there a chance to bind the data between this and the next Custom Control (this day and next day, because every day will be a Costum Control).
My question is if this is a good approach? And, if it isn't could you please help me out with some ideas?
private ICommand _RectangleMouseEnterCommand;
public ICommand RectangleMouseEnterCommand
if (_RectangleMouseEnterCommand == null)
_RectangleMouseEnterCommand = new RelayCommand(rectangleMouseEnter);
// This does get called
The rectangleMouseEnter method does get called. This means my list is wired wrong.
If I change "ListBoxItem.MouseDoubleClick" to "MouseEnter", then it fires. Anyone see what I'm doing wrong?
Didn't we answer this same exact question a few weeks ago? You can't handle nested events like that. You can only trap ListBox events there. If you want to trap ListBoxItem events, you need to add that to a ListBoxItem style.
LOL, you were the one who asked the question . Anyways, you need to attach the interaction triggers to a Visual, so you need to include the control template unfortunately. The interaction triggers are buried a few lines down . This does seem a little messy. Your other option is to have a reusable control that forwards the ListBoxItem event to the parent ListBox. That's what I do in my framework, but its a bit more work. One other simpler option might be to just trap the ListBox double click and chase up the visual tree to make sure you clicked on a ListBoxItem.
recently i moved my application from Winform to WPF, with winform when i choose files info my listbox the oped window to choose files different compare to the window now with WPF, can i change it to the one in Winform ?
here you can see the differents (WPF is the upper one)
I am currently developing uen WPF application I want to work with EFW, and I want to use the MVC architecture, I start with a small test, but it did not work .. I added a library or j 'I've added a WindowsForms want and when I add the time that reference to my project and I tried to post the form when click on the button help me please
You can use whatever you want, I was just pointing out that WPF is specifically designed with MVVM in mind. That doesn't mean you have to use MVVM in WPF. That means that WPF + MVVM is going to provide you with the cleanest code.
i have one user control in which i have placed 15 label controls,now i want to bind their content with an observableCollection, in which i am filling string values.
let me clear once again, i am filling list which is observableCollection and want to show each item in list as label values in usercontrol.
i have a application with ComboBox, the combobox contain the network adapters from local machine and i want when the application start the combobox will be marked (my default is blue) as if I pressed the button myself.
I have a method which saves my main window's position using isolated storage. Another method is responsible for loading the position. Easy. I call the "save" when closing the main window and the "load" when opening the window. Easy
But when the saved postion is applied to the newly opening window, I see the window appear briefly in the default position before it is relocated to the desired saved postion. This is annoying. Any idea on how to prevent that?
the problem when i see the link you gave me is to get panic first because its looks like very complicate compare to Winform properties
i don't know how to use in all this elements, i will glad to learn
On a WPF window, there is a TextBox which is bound to a property of number type (e.g. an int). When the user input contains characters (e.g. 12w34), the conversion to a number fails, and the setter of the underlying property does not get called, i.e. the property stays unchanged. But the textbox automatically receives a red border indicating that something went wrong.
I conclude that the data format error somehow found its way to the UI. Now I want to get informed about that error, so that I know that there is a discrepancy between the UI and the underlying ViewModel object.
For the purpose of learning, I do not want to prevent character input now.
How can I access that error, either when it just has been raised or somewhen later when I want to validate the object?
Thanks for the links. But they do not cover my problem: I do not care for a rule that my int must be between 1 and 99 or something like that, but that it must be an int! Just check the demo program of your second link: in the age field enter "1" and leave the field => it is ok. Then come back and add a letter, e.g. "w1" => it stays valid. Why? Exactly because of the problem I described above: the setter of the age property is not called now, the property's value is still 1, and that's ok. But not ok for me, because the UI shows a different (illegal) value.
How do you cope with such problems? Do you use a fully fledged WPF framework which handles such cases?
Also the Attached Behavior tries to prevent the problem, not to solve it after it has come to existence. At least, the framework you suggested (thanks for the link) covers copy&paste as an input method.
But still the problem that the UI contains "illegal" input exists:
It could be appropriate to explicitly allow entering wrong input. E.g. when using a barcode reader, I would not silently filter out unwanted characters, I'd rather tell the user that something wrong happened, e.g. he scanned from the wrong label.
And there might be input methods which do not use keyboard or copy&paste. Imagine an assistive technology which sends a WM_SETTEXT to the textbox...
There might be cases where preventing the wrong input by keyboard might be too complicated, i.e. here the wrong input would be possible, and the error happens when WPF tries to convert from string to the required datatype. A custom converter (IValueConverter) cannot directly talk with the ViewModel, exceptions would be handled by the WPF databinding classes.
Currently my impression is that I should change some properties in my ViewModel to string, since a conversion from string (TextBox.Text) to a string cannot fail. The property setter of the ViewModel then has to do the conversion to the type of the property in the underlying business object, and exceptions raised here can be easily caught. This means that the ViewModel class get even more bloated. But I'd easily cope with another bug of WPF: it always uses a decimal point, even when Windows regional settings tell that it should be a decimal comma.
I made a xps reader with the DocumentViewer control.How can I reader the xps file with DocumentStructView just like the doc file in Office Word open.- -!Sorry,my English is poor!Thanks.
public int ListInXpsDoc(string srcXpsDocument)
int numImages = 0;
int numPages = 0;
XpsDocument document = new XpsDocument(srcXpsDocument, FileAccess.Read);
IXpsFixedDocumentSequenceReader docSequence = document.FixedDocumentSequenceReader;
if (docSequence != null)
We're going to use Silverlight 5 for an out-of-browser application and need to have an individual title of the main window. In Silverlight 4 it was not possible to set this property as far as I know (See this issue). By default the main window has the title of the project followed by "Application". Does Silverlight 5 bring the ability to change the main window title? Maybe even during runtime via data binding?
Last Visit: 31-Dec-99 19:00 Last Update: 24-Nov-17 14:28