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
1253
Minimize/Maximize TilePane icons
posted

Hello,

Is there a way how to control these icons in the code behind?  Tx!

 

Parents
  • 1140
    Suggested Answer
    posted

    Your best option is to manage the toggle button path / image in xaml by defining a new style, the below code demonstrates this.  You will want to tweak this to your own needs of course.

    <Style x:Key="ToggleStyleZoom" TargetType="ToggleButton">
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="ToggleButton">
    <Grid>
    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="CommonStates" ic:ExtendedVisualStateManager.UseFluidLayout="True">
    <VisualState x:Name="Normal"/>
    <VisualState x:Name="MouseOver">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Border.Background)">
    <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource btnHoverBrush}"/>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Pressed">
    <Storyboard>
    <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Border.Background)">
    <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource btnPressedBrush}"/>
    </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="Disabled"/>
    </VisualStateGroup>
    <VisualStateGroup x:Name="CheckStates">
    <VisualState x:Name="Checked"/>
    <VisualState x:Name="Unchecked"/>
    </VisualStateGroup>
    <VisualStateGroup x:Name="FocusStates">
    <VisualState x:Name="Focused"/>
    <VisualState x:Name="Unfocused"/>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <VisualStateManager.CustomVisualStateManager>
    <ic:ExtendedVisualStateManager/>
    </VisualStateManager.CustomVisualStateManager>
    <Border x:Name="Bd" Background="{StaticResource BaseBorderBrushKey}" BorderBrush="#BFFFFFFF" BorderThickness="1,0,1,1" CornerRadius="0,0,2,2">
    <Border Margin="1,0,1,1" BorderBrush="#59FFFFFF" BorderThickness="1,0,1,1" CornerRadius="0,0,1,1">
    <Grid>
    <Image Margin="51,8,52,8" Source="Images/zoom_16.png" Stretch="Fill"/>
    </Grid>
    </Border>
    </Border>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    <Setter Property="Background" Value="{StaticResource BaseBorderBrushKey}"/>
    <Setter Property="Foreground" Value="White"/>
    </Style>

Reply Children