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 8262899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:54:46+00:00 2026-06-08T03:54:46+00:00

I have a UserControl that has a repeating-image background set with the following code:

  • 0

I have a UserControl that has a repeating-image background set with the following code:

<UserControl.Background>
    <ImageBrush ImageSource="Resources/image.jpg" Viewport="0,0,32,32" ViewportUnits="Absolute" TileMode="Tile" Stretch="None" AlignmentX="Left" AlignmentY="Top" />
</UserControl.Background>

And it works fine. However, the problem is that the tiled images originate from the top of the control, so that if the control is resized vertically, the newly visible parts of the background seem to come out of the bottom of the control.

I would like the images to be tiled from the bottom to the top rather than the top to the bottom so that upon resizing the control, the newly visible background comes from the top, not the bottom

How can I do this? I have tried setting AlignmentY to Bottom but it didn’t change a thing.

  • 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-06-08T03:54:48+00:00Added an answer on June 8, 2026 at 3:54 am

    Ok, this may not be what you are looking for, but i found your question very interesting.

    I was able to do it horizontally (new images appear from the left, instead of the right).
    By setting the “FlowDirection” to “RightToLeft” on your user control, it will do what you require HORIZONTALLY. I have no idea if this is possible vertically. I am still looking into it….

        <Canvas FlowDirection="RightToLeft">
            <Canvas.Background>
                <ImageBrush ImageSource="Resources/image.jpg" Viewport="0,0,32,32" ViewportUnits="Absolute" TileMode="Tile" Stretch="None" AlignmentX="Left" AlignmentY="Bottom" />
            </Canvas.Background>
        </Canvas>
    

    This is the first element of my UserControl, but this “FlowDirection” could be placed on your base element (usually a Grid) at the root of your user control. However, with the canvas, you can be insured that this “flow direction” will not affect any other component in your user control.

    Hope this points you in a good direction.

    — EDIT —

    LOL I can’t believe this works, but it does! Based on my first work, and using a Converter for the canvas’ margin:

    Converter:

        [ValueConversion(typeof(double), typeof(Thickness))]
        public class SizeToInverseMarginConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                if (targetType != typeof(Thickness))
                    throw new InvalidOperationException("The target must be of type 'Thickness'");
    
                double vNewVal = -5000 + (double)value;
                return new Thickness(0, vNewVal, 0, 0);
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotSupportedException();
            }
        }
    

    Then the user control’s content:

    <UserControl.Resources>
        <My:SizeToInverseMarginConverter x:Key="s2m" />
    </UserControl.Resources>
    <Grid x:Name="MainGrid">
        <Canvas FlowDirection="RightToLeft" Margin="{Binding Path=ActualHeight, ElementName=MainGrid, Converter={StaticResource s2m}}">
            <Canvas.Background>
                <ImageBrush ImageSource="Resources/image.jpg" Viewport="0,0,32,32" ViewportUnits="Absolute" TileMode="Tile" Stretch="None" AlignmentX="Left" AlignmentY="Bottom" />
            </Canvas.Background>
        </Canvas>
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a UserControl whose DataContext is set to an object that has
I have a UserControl with something that does some background work. When thing has
I have an WPF usercontrol that has a TextBox. I set the text Underline
I have the following link defined in a .NET 1.1 usercontrol that has the
I have a UserControl that has a BaseClass object as a public member. Right
I have created a UserControl that has 3 panels. What I what to do
i have an usercontrol that has a public event. when i use this user
In other words, I have a UserControl that has, for example, a label on
I have an ASP.Net application that has a UserControl that needs to be rendered
I have a usercontrol that has a popup that displays another usercontrol when the

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.