Wpf Calendar Control Customization - wpf

I have a calendar control (WPFToolkit) in a wpf form and I need to put a "Today" button in it.
Is there a way to di that?

Why not just inherit from that control and override its default style? Put in that style "Today" button and subscribe to its Click event in OnApplyTemplate()...

Related

Reuse calendar button from DatePicker for custom control

Is there a way to reuse the button from the DatePicker for my custom control? Or a way to get the bitmap image from the DatePicker button?
There's information on this page about the DatePicker Style/Template:
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/datepicker-styles-and-templates?view=netframeworkdesktop-4.8
However it makes no mention of the image used on the button. Is there somewhere else on MSDN when I can find the information?

Displaying a disabled reason when selecting a disabled ListBox item

I have a ListBox that has items that should not be selectable because they are disabled. I accomplished this by binding the IsEnabled property which disabled the item. However, I need to be able to display a popup that shows the reason why it's disabled when the user clicks on the disabled item. What is the best practice for accomplishing something like this?
you can do it this way:
create an hidden transparent control above the listBox. make this control visible when listbox gets invisble. register to MouseDown on this control which will show the popup etc...

TabControl TabIndexChanged won't fire

The TabIndexChanged event of the Windows Forms TabControl doesn't fire when I change between tabs. But the SelectedIndexChanged event is fired.
What is the explanation for this?
The TabIndexChanged event fires when you change the TabIndex property of the control-- the order of controls related to the parent form, etc. It has nothing to do with when the user is switching tabs.
Besides the SelectedIndexChanged event, you probably want to explore the Selected, Selecting, Deselected, and Deselecting events to determine what to do when the user is changing tabs.

How to inherit from silverlight Button?

I need to have button have 4 images that are changed by the application action.
I want to define new class ButtonEx that inherit from the Button class.
So, i did it by adding 'silverlight template control' and it to be inherit from control to Button.
Now, i cant see the images whan i put this ButtonEx on the page.
What i did wrong ?
How to fix it ?
( same code work fine in WPF )
Can you post any of your code? Did you create a visual style for it in themes\generic.xaml? Did you set the default style key?
I recently followed this tutuorial for a TextBox, you could so something similar for your button... http://www.silverlightshow.net/items/Create-a-Custom-Control-Inheriting-from-TextBox.aspx
Store your images as resources then create a user control that has
- a button and the content of the button is an image
- a property to select the image from the resources
use the usercontrol as your button.
please post a code sample...
to inherit form button you simply need this.
public class ButtonEx:Button
{
}
this will have all functionality that button has.
if you want new template just add it in Themes/generic.xaml
From your question its not clear that you really need to be subclassing Button. Maybe you can get by with just copying and modifying the template of button (Blend helps for this), or just have the image as content bound to some property for the application to change (using a ValueConverter perhaps).

Combobox with button instead of textbox

I would like to create a combobox without any textbox and with a customizable icon in the button that opens the combobox. Something like this image (forget about the checkboxs)
I don't need you to post the solution, just some directions or resources so I can know how to begin this customization.
TIA
ContextMenuStrip which you manually display in the button's Click handler.

Resources