Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4046340
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:33:01+00:00 2026-05-20T13:33:01+00:00

I want to make a grid with wrap panel behavior and resizable control inside

  • 0

I want to make a grid with wrap panel behavior and resizable control inside it, how can I do this?
maybe it’s easier to show what I want in images :

initial state:

enter image description here

resize control 1 with direction bottom-right so it will take around 2×2 cells, then control 2 and so on will rearrange it’s position on the grid:

enter image description here

when it’s resized back it should be back to initial state.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:33:02+00:00Added an answer on May 20, 2026 at 1:33 pm

    You would just need to create a class that extends Panel to create the animations. Here is a very good article on how to create an animated WrapPanel. Then, you would need to create a DataTemplate for your items that uses Triggers to grow and shrink each one. This could also be animated in the Trigger. The Panel would automatically move the other items around as the item changes size… dependent on the code you put in your Panel.ArrangeOverride method.

    You would need to create a data type (class) to use as your items (squares). This class would need a string property to store the box number and a bool IsLarge property to let the UI know whether to display it large or not. I haven’t actually tried this code, but you could use something like this for your DataTemplate:

    <DataTemplate DataType="{x:Type YourXmlNameSpace:YourDataType}" x:Key="BoxTemplate">
        <Border Name="Border" BorderBrush="Black" BorderThickness="1" CornerRadius="3" Height="100" Width="100">
            <TextBlock Text="{Binding YourTextProperty}" />
        </Border>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding IsLarge}" Value="True"><!-- (A Boolean property) -->
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Height" From="100" To="200" Duration="0:0:0.5" />
                            <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Width" From="100" To="200" Duration="0:0:0.5" />
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
                <DataTrigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Height" From="200" To="100" Duration="0:0:0.5" />
                            <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Width" From="200" To="100" Duration="0:0:0.5" />
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.ExitActions>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
    

    Then you associate the DataTemplate with each ListBoxItem like this:

    <Style TargetType="{x:Type ListBoxItem}" x:Key="BoxStyle">
        <Setter Property="ContentTemplate" Value="{StaticResource BoxTemplate}" />
        <Style.Resources><!-- this removes the default blue selection colour -->
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#00FFFAB0" />
            <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#00FFFAB0" />
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
            <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
        </Style.Resources>
        <Style.Triggers><!-- comment this section out, or declare a SelectedBoxTemplate DataTemplate -->
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="ContentTemplate" Value="{StaticResource SelectedBoxTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    

    I haven’t defined any SelectedBoxTemplate DataTemplate, but you could declare a different one that would get activated using the Style.Trigger.

    Then finally, you would declare your ListBox something like this:

    <ListBox ItemsSource="{Binding YourCollection}" ItemContainerStyle="{StaticResource BoxStyle}">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <YourXmlNameSpace:YourAnimationPanel />
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
    </ListBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make sure people can't type the name of a PHP script
Sorry if this has already been asked, but I just want to make sure
When pressed Once,i want to make the Grid view Button(Time In) invisible until the
I want to make a string grid to display some kind of vertical cursor
I want to make a RPG where you engage foes utilizing a map/grid. I'm
I want to make this kind of window using CSS, JQUERY, AJAX, OR JAVASCRIPT
I want to make a custom design for my magento store like this :
I want to make an etag that matches what Apache produces. How does apache
I want to make a table in SqlServer that will add, on insert, a
I want to make a copy of an ActiveRecord object, changing a single field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.