Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4970
How to set different template for SelectedGroupHeader for xamOutlookBar?
posted

I wan to put something in SelectedGroudHeader, so create a style as blow. I add ContentContainer "MyControl" to the header in template style.  Then I want to set different content for different OutlookBarGroup. For exaplme, different OutlookBarGroup with different menu inside MyControl.

Asthis style is applied to all OutlookBarGroup, how can I do it in xaml or in code-behind in this case?

<Style x:Key="SelectedHeaderStyle" TargetType="igPrim:SelectedGroupHeader">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <LinearGradientBrush.GradientStops>
                            <GradientStopCollection>
                                <GradientStop Offset="0" Color="#FFba53be"/>
                                <GradientStop Offset="0.972" Color="#FF751a71"/>
                            </GradientStopCollection>
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderBrush" Value="#034A53BE"/>
            <Setter Property="Foreground" Value="#FFFFFFFF"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="igPrim:SelectedGroupHeader">
                        <Grid Margin="0,0,0,1">
                            <Border Background="{TemplateBinding Background}" BorderThickness="0">
                                <Grid>
                                    <Grid.Resources>
                                        <igPrim:GroupHeaderConverter x:Key="HeaderConverter"/>
                                        <igPrim:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <ContentPresenter
                                        x:Name="ContentPresenterHeader"
                                        Grid.Column="0"
                                        Margin="7,7,8,3"
                                        Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.SelectedGroup.Header, Converter={StaticResource HeaderConverter}}"
                                        ContentTemplate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.SelectedGroup.HeaderTemplate}"
                                        Visibility="Visible"/>


                  <ContentControl x:Name="MyControl"></ContentControl>


                                    <ToggleButton
                                        x:Name="MinimizeButton"
                                        Grid.Column="2"
                                        Margin="0,4,0,3"
                                        IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.IsMinimized, Mode=TwoWay}"
                                        RenderTransformOrigin="0.5 0.5"
                                        Style="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.MinimizeToggleButtonStyle}"
                                        Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.AllowMinimized, Converter={StaticResource BoolToVisibilityConverter}}">
                                        <ToolTipService.ToolTip>
                                            <Grid>
                                                <TextBlock x:Name="ExpandTooltip" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.StringSettings.MinimizeButtonExpandTooltip}" Visibility="Collapsed"/>
                                                <TextBlock x:Name="MinimizeTooltip" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OutlookBar.StringSettings.MinimizeButtonMinimizeTooltip}"/>
                                            </Grid>
                                        </ToolTipService.ToolTip>
                                        <ToggleButton.RenderTransform>
                                            <RotateTransform x:Name="TgbRotation" Angle="0"/>
                                        </ToggleButton.RenderTransform>
                                    </ToggleButton>
                                </Grid>
                            </Border>
                            <Border x:Name="innerBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,0,0"/>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="MinimizedStates">
                                    <VisualState x:Name="Expanded">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames
                                                BeginTime="00:00:00"
                                                Duration="00:00:00.001"
                                                Storyboard.TargetName="ContentPresenterHeader"
                                                Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Minimized">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames
                                                BeginTime="00:00:00"
                                                Duration="00:00:00.001"
                                                Storyboard.TargetName="ContentPresenterHeader"
                                                Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames
                                                BeginTime="00:00:00"
                                                Duration="00:00:00.001"
                                                Storyboard.TargetName="MinimizeButton"
                                                Storyboard.TargetProperty="ToggleButton.RenderTransform.RotateTransform.Angle">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="180"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames
                                                BeginTime="00:00:00"
                                                Duration="00:00:00.001"
                                                Storyboard.TargetName="MinimizeTooltip"
                                                Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames
                                                BeginTime="00:00:00"
                                                Duration="00:00:00.001"
                                                Storyboard.TargetName="ExpandTooltip"
                                                Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

 

Parents Reply Children
No Data