WPF Using Extended Toolkit Wizard - How to hide footer area? - wpf

I am using Extended Toolkit to create a wizard in WPF.
I choose PageType = WizardPageType.Blank.
I want to see an empty page, but I still see the footer area (I hide all buttons).
How can I hide this footer area?

There is no property to hide the footer area.
However, you can override the control template of the wizard. FYI, the default style is available on GitHub.
Assuming the namespace xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit", your "very basic" control template could look like this:
<Style TargetType="{x:Type xctk:Wizard}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type xctk:Wizard}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
<Grid>
<ContentPresenter Content="{Binding CurrentPage, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Place this into Window.Resources or Application.Resources or wherever you like.

Related

Custom WPF Calendar Inside a DatePicker

I've created a custom Usercontrol based on the Calendar control. I would like to use this calendar as the popup control within a datepicker, though it is not a style thus:
CalendarStyle="{StaticResource customCalendar}"
Does not work.
Is there anyway to do this without having to create an entire custom DatePicker?
I have found a solution, I can actually easily do this using styling.
<Style x:Key="CustomCalendar" TargetType="Calendar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Calendar}">
<StackPanel HorizontalAlignment="Center" Name="PART_Root" Background="LightGray">
<CalendarItem Background="{TemplateBinding Control.Background}" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" Name="PART_CalendarItem" Style="{TemplateBinding Calendar.CalendarItemStyle}"/>
.
.
.
.
.
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
then placing all other controls I wish to use within the stack panel.

Semi-transparent background only in controls

I wonder if it's possible to make a new template (e.g. for a button), that have semi-transparent background? I can set the Background property and then choose my Opacity, but here lies the problem... When I set opacity of the background, each element added as a content of an element with set Opacity will be transparent, too. How to avoid it?
How about this? It's just a simple version. You will have to add the triggers etc by yourself.
<Style x:TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate x:TargetType="Button">
<Border BorderBrush="{TemplateBinding BorderBrush}">
<Grid>
<ContentPresenter Content="{TemplateBinding Content}"/>
<Border Background="{TemplateBinding Background}"/>
</Grid>
</Border>
<ControlTemplate/>
</Setter.Value>
<Setter/>
</Style>
Now you can assign any background brush you want without influencing the content.

Dropshadow UserControl

I think doing the following is probably pretty common:
<Grid>
<Border>
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
</Border>
<SomeControl/>
</Grid>
Ok, I did that without the aid of the ide which I am admittedly lost without so forgive me if I forgot something but I think you get the point.
My question is, would it be possible to create a UserControl that would allow me to do this instead:
<DropShadowBorder>
<SomeControl/>
</DropShadowBorder>
If so, please do tell how.
EDIT: Just in case it's not immediately obvious, the point here is that I would usually put a border around my control but when I want to use a drop shadow I can't because I only want the border to have a drop shadow and not everything in it. So instead I have to create the border separately in the same grid space, but this is annoying because when I adjust margins and such on my control I have to go duplicate those changes on the border each time.
You can't do a user control (user control cannot have a content). You will have to create a custom control. I suggest you to create a custom control that derives from ContentControl.
The code of the custom control (default code !):
public class DropShadowBorder : ContentControl
{
static DropShadowBorder()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DropShadowBorder), new FrameworkPropertyMetadata(typeof(DropShadowBorder)));
}
}
Then define a default style for your control (in generic.xaml)
<Style TargetType="{x:Type local:DropShadowBorder}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:DropShadowBorder}">
<Grid>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border.Effect>
<DropShadowEffect />
</Border.Effect>
</Border>
<ContentPresenter Content="{TemplateBinding Content}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

Month cannot be altered in Silverlight DatePicker when custom CalendarStyle is specified

I've taken a DatePicker and customised the style for usage on a tablet. I'm finding that while days can be selected the month cannot be changed. Neither clicking the previous/next button or on the month name has any affect, although the mouseover style is applied.
I've taken the default Calendar style and inserted a Viewbox to increase the size, as suggested by Mike Taulty: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/11/17/touched-part-5-touch-ready-controls.aspx
<Style TargetType="controls:Calendar" x:Key="TabletCalendar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Calendar" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
<StackPanel x:Name="Root" HorizontalAlignment="Center" >
<Viewbox Width="480" Height="440">
<controlsPrimitives:CalendarItem x:Name="CalendarItem" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" xmlns:controlsPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls" />
</Viewbox>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:DatePicker" x:Key="TabletDatePicker">
<Setter Property="CalendarStyle" Value="{StaticResource TabletCalendar}" />
.....
</Style>
Fixed by moving the Viewbox up a level in the visual tree, not sure why there was a fault here but is working fine now!

Silverlight 4 - Mousewheel stops scrolling ScrollViewer when over contained RichTextBox

I have a Silverlight 4 out-of-browser application with a ScrollViewer that has several RichTextBoxes inside. The RichTextBoxes are only used for displaying text, and are never edited and never scroll.
However when the mouse is hovering over a RichTextBox the mousewheel event seems to not reach the ScrollViewer. Is there any way to overcome this limitation?
The reason a readonly RichTextBox doesn't scroll is because the default template for RichTextBox uses a ScrollViewer instead of a ContentControl. So to solve the problem, you need to create your own template for RichTextBox.
What I did was to create a copy of the RichTextBox template in Blend, and strip it down for the readonly case. This removes about 90% of the template. The following style/template remains:
<Style TargetType="c:RichTextBlock">
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid x:Name="RootElement">
<Border x:Name="Border" CornerRadius="0"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
>
<ContentControl x:Name="ContentElement" IsTabStop="False" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Use this style/template for your readonly RichTextBox'es, and you should be good to go.
Goood luck,
Jim McCurdy
Face to Face Software and YinYangMoney

Resources