I am creating a 12 month calendar using the individual calendar controls for each month. Since I am controlling the calendars (Jan - Dec) via separate next year and previous year buttons, I want to remove the previous and next calendaritem buttons from the individual calendars and disable the ability to change the display mode. 

Since I am new to XAML and more comfortable with doing this in code, I would prefer to change the style at runtime but willing to learn how to make it happen via XAML but I am having a very difficult time finding an example of someone doing something like this.

Hope someone can help.
['https://Stackoverflow.com/questions/13086869', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1777028/']
Well, after lots of digging, many examples and Dodsky pointing me in the right direction. I figured it out and felt that sharing was the best way to repay the developer community. Since, I am new to XAML it is a small victory in project battle that I am in. Hopefully, it will help other newbies like me.

I will try to explain the best way that I can to show you how to manipulate the calendar any way that you need to.

In my UserControl

```
<Calendar CalendarItemStyle="{DynamicResource calItemStyle}"  Name="calJan"    
 HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" 
 HorizontalAlignment="Center" VerticalAlignment="Center" OverridesDefaultStyle="False" 
 IsEnabled="True" />

```

Some of the parameters are overkill, the main point is the Dynamic Resource

```
CalendarItemStyle="{DynamicResource calItemStyle}"

```

In my ResourceDictionary, I added the namespace

```
xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework"

```

You will also want to add the PresentationFramework reference to your project, if it is not already there.

```
<Style x:Key="calItemStyle"
           TargetType="primitives:CalendarItem">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="primitives:CalendarItem">
                <ControlTemplate.Resources>
                    <DataTemplate x:Key="DayTitleTemplate">
                        <TextBlock Text="{Binding}"
                                       HorizontalAlignment="Center" />
                    </DataTemplate>
                </ControlTemplate.Resources>

                <DockPanel Name="PART_Root" 
                               LastChildFill="True">
                    <Button x:Name="PART_PreviousButton" 
                                DockPanel.Dock="Left"
                                Content="&lt;"
                                Focusable="False" 
                                Visibility="Hidden"
                                />

                    <Button x:Name="PART_NextButton" 
                                DockPanel.Dock="Right"
                                Content="&gt;" 
                                Focusable="False" 
                                Visibility="Hidden"
                                />

                    <Button x:Name="PART_HeaderButton"                                             
                                DockPanel.Dock="Top"
                                FontWeight="Bold"
                                Focusable="False" />

                    <Grid>
                        <Grid x:Name="PART_MonthView" 
                                  Visibility="Visible">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                        </Grid>

                        <Grid x:Name="PART_YearView" 
                                  Visibility="Hidden">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </Grid>
                    <Rectangle x:Name="PART_DisabledVisual" Opacity="0" Visibility="Collapsed" Fill="#A5FFFFFF"/>
                </DockPanel>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter TargetName="PART_DisabledVisual" Property="Visibility" Value="Visible" />
                    </Trigger>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Calendar}}, Path=DisplayMode}" Value="Year">
                        <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
                        <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Calendar}}, Path=DisplayMode}" Value="Decade">
                        <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
                        <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
                    </DataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

```

I chose to hide the Previous and Next buttons, just in case removal caused a problem with any events but otherwise, it does what I want it to and I can add or take away features as needed.

Hope this helps others.
Like Chris, I didn't want to mess with a ton a XAML. I also needed to hide/show dynamically. I imagine there is a way to do this with bindings in XAML as well, but I thought this was a pretty simple start. Just add a new class with this code, then use this derived control instead.

Edit: I updated it to have a property you can set, HidePrevNextBtns. If checked/true, buttons will be hidden. This code does make a couple assumptions. One is that the template will also have prev/next buttons, and other is they will be visible by default.

```
class MyCalendar : Calendar 
{
    public Button PrevBtn;
    public Button NextBtn;

    protected bool _HidePrevNextBtns;
    public bool HidePrevNextBtns
    {
        get
        {
            return (_HidePrevNextBtns);
        }
        set
        {
            _HidePrevNextBtns = value;
            if (PrevBtn != null)
            {
                PrevBtn.Visibility = _HidePrevNextBtns ? Visibility.Hidden : Visibility.Visible;
                NextBtn.Visibility = _HidePrevNextBtns ? Visibility.Hidden : Visibility.Visible;
            }
        }
    }

    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();

        var cal = this.Template.FindName("PART_CalendarItem", this) as CalendarItem;

        cal.Loaded += new RoutedEventHandler(cal_Loaded);
    }

    void cal_Loaded(object sender, RoutedEventArgs e)
    {
        var cal = sender as CalendarItem;
        PrevBtn = cal.Template.FindName("PART_PreviousButton", cal) as Button;
        NextBtn = cal.Template.FindName("PART_NextButton", cal) as Button;
        if (_HidePrevNextBtns)
        {
            PrevBtn.Visibility = Visibility.Hidden;
            NextBtn.Visibility = Visibility.Hidden;
        }
    }
}

```