Unplanned
Last Updated: 03 Aug 2016 13:48 by ADMIN
ADMIN
Martin Ivanov
Created on: 28 Jul 2016 08:53
Category: OutlookBar
Type: Bug Report
1
OutlookBar: The minimize button overlaps the title of the control
You can work this around by extracting the RadOutlookBar style and slightly modify it. You can find the Grid panel that holds the title and the minimize button and position the elements in different columns. 
 
<!-- Other XAML from the template -->
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <ContentControl x:Name="TitleElement" ContentTemplate="{TemplateBinding TitleTemplate}" Foreground="#FFDDDDDD"
                    FontWeight="Bold" HorizontalContentAlignment="Stretch" IsTabStop="False" Margin="5,3"
                    VerticalAlignment="Center" VerticalContentAlignment="Center"/>
    <telerik:RadToggleButton x:Name="MinimizeButton" Grid.Column="1"
                             IsChecked="{Binding IsMinimized, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                             Style="{TemplateBinding MinimizeButtonStyle}">
        <telerik:RadToggleButton.Visibility>
            <Binding Path="IsMinimizable" RelativeSource="{RelativeSource TemplatedParent}">
                <Binding.Converter>
                    <telerik:BooleanToVisibilityConverter/>
                </Binding.Converter>
            </Binding>
        </telerik:RadToggleButton.Visibility>
    </telerik:RadToggleButton>
</Grid>
<!-- Other XAML from the template -->

Another approach is to use the ChildrenOfTypeExtensions.ChildrenOfType<T>() method to get the Grid and the minimize button, and add set the required properties. Here is an example:

private void outlookBar_Loaded(object sender, RoutedEventArgs e)
{
    var minimizeButton = this.outlookBar.ChildrenOfType<RadToggleButton>().FirstOrDefault(x => x.Name == "MinimizeButton");
    if (minimizeButton != null)
    {
        var parentGrid = minimizeButton.ParentOfType<Grid>();
        parentGrid.ColumnDefinitions.Add(new ColumnDefinition());
        parentGrid.ColumnDefinitions.Add(new ColumnDefinition());
        Grid.SetColumn(minimizeButton, 1);
    }
}
0 comments