I have the word "subclass" in the title because that's the only idea I have for doing this, but maybe not?
What I need is to only use the years of a calendar control - I don't need either the months view nor the days view. I thought of writing a custom control that does this, but since calendar already has the very cool "Decade" view, I wanted to use that.
I tried handling the DisplayDateChanged event and forcing the mode back to Decade, but what happens is that the months show on click, and then disapear showing the Decade view again.
Any "interesting hacks" for doing this?
In C++, I always knew I can do a "real subclass" and intervene in the control's behavior - Can this be done?
Check out this article on styling for the Calendar control, it may get you started.
http://msdn.microsoft.com/en-us/magazine/dd882520.aspx
Related
I am making a react calendar. When I am in my default view, which is today's day view, I want the months calendar (in typical calendar form) to show on the right hand side. Like an extra side panel.
I have been looking for a few hours and I haven't been able to find anyone/examples of something similar.
I am going to post a picture of my desired outcome. If anyone has come across something like thing, please let me know.
You would use a basic calendar control (Big Calendar would be overkill), in your right hand panel, and need some logic to sync displays in some way (probably by controlling your date prop at a higher level, and sharing between the two)
By default, in the days of calendar it is shown the day of the month, but I would like to modify the calendar to be able to show more text, like the events of the day.
I have serach on internet and I have found examples how to create a new control, but I would like to know if it is a way to modify the estandar control to show this information.
Thanks.
If you want to customize the Data displayed in a Datepicker- or Calendarcontrol you need to modify its control template.
This is the way to go if you want to extend any WPF Control.
You can find information on how to specifity modify the calendar control here.
I want to take advantage of DateTimePicker's date validation, but the calendar seemed cumbersome to our customers for setting the date (they'd rather do it using just the keyboard, tabbing their way through the form).
So I took a long look at the documentation and found that one way to get rid of the calendar was setting the ShowUpDown property to true. So I got this:
However, our customers are now saying that they don't want to use the spin button, and therefore they don't want it to be visible/accesible. i.e. they want this:
However, if i set ShowUpDown to false, I'm back to the calendar. Is there another way?
Had to roll my own Custom Control. Luckily, some other guy from the team has already written custom controls so I have example code to get started. Anyway, what good is a framework if I have to do this kind of things myself? Hope they solved this in .net 4.5...
EDIT: Using a MaskedTextBox with ValidatingType = typeof(System.Date) is a better solution. Sorry .NET!
I'm trying to build a maintenance form in WPF, using Telerik's WPF controls. The idea is to have a grid and a form that are bound to the same collection. Changes to the grid should be immediately reflected in the form, and vice versa. An online example using Telerik's Silverlight controls is here.
My specific problem is that when I enter a new record (by clicking on the "Add" icon in the upper-right of the DataForm), the record is added to both the grid and to the form's collection, but it seems to break the synchronization. The new row in the grid stays highlighted, like the grid thinks it's not done being edited, and while changes to the current record in the form are reflected in the grid, changes to the current record in the grid are no longer being reflected in the form.
But my real problem is more general than that. WPF controls, like Telerik's, are heavily dependent on binding, and in having what they bind to support specific behaviors. In this case, the underlying record needs to support INotifyIEditableObject, so that when the user hits the Cancel button on the form, the EditCancel method on the record can be called. Which is then responsible for setting its properties back to what they had been, and then raising a NotifyPropertyChanged event, so that controls that are informed that they have been so set.
When I didn't have EditCancel working right, I would hit cancel on the form and the values in the grid would not be changed. My guess as to what is going on with the inserts is that something in either my collection or by records doesn't support whatever it is that makes this work. The grid doesn't know that the form has finished editing the record because either my record or the collection hasn't told it.
And here's the real question: how can I find out what these third-party controls are expecting? Telerik's RadGrid can be bound to pretty much anything that can be IEnumerated. But all this neat enhanced functionality depends upon being bound to collections that are very much more specific. I don't get errors, when I bind to a collection that lacks facilities that are needed for certain functions to work, I just get a control that doesn't work.
How can I tell, when working with someone else's control, for which I do not have source code, what functionality it requires, in the objects it binds to?
Your best bet would be to browse Telerik's documentation or ask on their support forums
If that doesn't work, I like to use Snoop for debugging WPF's Visual Tree and Reflector for looking through compiled libraries
If not, what's the best way of sanitizing users' input (keyboard and pasting from the clipboard)?
DevExpress is releasing version 9.2 of their controls this week which includes a masked edit control based on RegEx:
http://community.devexpress.com/forums/p/78946/270208.aspx#270208
Aside from that you're stuck hacking KeyDown and TextChanged events to cobble something together. I've done a lot of that and I've got to say its not pretty and very hard to test! I'm not aware of a free control at the moment that does this.