add a delete button only in small & normal view

2 posts, 0 answers
  1. Sam
    Sam avatar
    10 posts
    Member since:
    Dec 2013

    Posted 11 Jan Link to this post

    Hello;

     

    I use telerik tile view in our project.

    We have customized the template to add a "remove button" in the header by editing the tileview template. The delete button is available in the different views (small, normal & large). We have been requested to set the button only in small & normal view. So, how can we remove the "delete button" from the large view only.

     

    Thanks for your replies.

    Best regards

     

  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 11 Jan Link to this post

    Hi Sam,

    I'm assuming that you are familiar with our documentation article where we described together with code samples how you might customize the TileViewItemHeader to add close button. Since this code will result in close button for every TileState -- Maximized, Restored or Normal you might easily control at which tile state it will appear in xaml. All you need to do is to make the CloseButton Visibility Collapsed when TileState is maximized. For example:

        ...
    <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="TileStates">
                                        <VisualState x:Name="Maximized">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="IsChecked" Storyboard.TargetName="MaximizeToggleButton">
                                                    <DiscreteObjectKeyFrame KeyTime="0">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <System:Boolean>True</System:Boolean>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="CloseButton">
                                                    <DiscreteObjectKeyFrame KeyTime="0">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Collapsed</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
    ...

    Let me know how this works for you.
    P.S. The full source code for the sample in this help article is available in a SDK sample - here.

    Regards,
    Evgenia
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top