![]() ![]() ![]() Now it takes up all the available space, in both directions. You can easily make it stretch to fill all space in both directions though - simply change the Stretch property from its default Uniform value to Fill: ![]() This is noticeable because the window is higher than it is wide and by default, the Viewbox will stretch while maintaining the original aspect ratio. You will probably also notice that the Calendar control doesn't use up all the available height space. The scaling is performed on all parts of the control, including font sizes and border widths. Notice how the Calendar control now scales up to the point where it uses all the available space in the width. We'll use the Viewbox control for this purpose: Fortunately for us, everything in WPF is scalable but in the case of the Calendar control, it needs a bit of help. This fixed size behavior is not very typical WPF, where things usually stretch to fill out available space, and it can be a bit annoying to work with if you have a designated amount of space available for the calendar which you want it to fill out. In fact, even if you give it a large width and height, the actual calendar part will still only take up the amount of space you see on the screenshot, and if you set either of the values very low, the calendar will only be partially visible. You will probably notice from our first example that the Calendar doesn't take up all the available space. Unless you set a specific date, the current month will be shown and the current date will be marked as selected. Notice how you now get a full list of the dates within the selected month, including the possibility to jump to previous and next months using the arrows in the top of the control. It's so simple that you only have to drop it inside your window for a full calendar view, like this: WPF comes with a control for displaying a full calendar right out of the box. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |