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

  • SEARCH
  • Home
  • 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 7797115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:34:53+00:00 2026-06-01T23:34:53+00:00

In WPF, I have a Uniform Grid and would like to be able to

  • 0

In WPF, I have a Uniform Grid and would like to be able to find the row and column based on the index of a child element.

I know there is a mathematical way of doing this and would rather not use a normal Grid.

If it helps, I can get the total number of rows and columns by using:

Math.Sqrt([*uniformgrid*].Children.Count)
  • 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-01T23:34:55+00:00Added an answer on June 1, 2026 at 11:34 pm

    Sorry this is in C# but in principle you need to do

    int rows = theGrid.Rows;
    int columns = theGrid.Columns;
    
    int index = theGrid.Children.IndexOf(childElement);
    
    int row = index/columns;  // divide
    int column = index%columns;  // modulus
    

    And in VB.NET

    dim rows as Integer = theGrid.Rows
    dim columns as Integer = theGrid.Columns
    dim index as Integer = theGrid.Children.IndexOf(childElement)
    
    dim row as integer = index \ columns
    dim column as integer = index mod columns
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WPF combobox bound to a ObservableCollection ItemCategoryList <ComboBox Grid.Column=1 Grid.Row=2 Height=Auto HorizontalAlignment=Stretch
I have 18 Buttons within a Uniform grid on my main WPF window. I
I have WPF application that has a login form. I would like to make
I have a WPF Toolkit DataGrid control, contained within a Grid, inside a ViewBox
I have a grid in WPF which is made of 4 rows along 2
do routed events from wpf have something in common with the chain of responsibility
WPF controls have certain properties (UserControl.Resources, UserControl.CommandBindings) that can have items added to them
I have WPF Span that is used as a source to a TextBlock. I
I have WPF Application where I have One main form and other user controls
I have WPF Form which has many buttons with the same code. Appearance of

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.