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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:45:51+00:00 2026-05-14T08:45:51+00:00

I have a grid with repeated columns with same style but different names the

  • 0

I have a grid with repeated columns with same style but different names the name are important for me in code behind so i decided to create a template to repeat the element and read the names from an XML file but i found out i can not use binding for name property please kindly help me sooooooooooooooooooooooooooon

here is a part of my code:

<DataTemplate  x:Key="weekItemTemplate">
            <Gridx:Name="{Binding XPath=Container}" Style="{DynamicResource GridStyle}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.9*"/>
                    <RowDefinition Height="0.1*"/>
                </Grid.RowDefinitions>
                <Rectangle x:Name="Rectangle"  Grid.Row="0" Margin="0,0,0,0.063"/>
                <TextBlock x:Name="Christian"  HorizontalAlignment="Left" Width="18.52" Grid.Row="1" Margin="1,0,0,0"><Run Text="08"/></TextBlock>
                <TextBlock x:Name="Hejri" Grid.Row="1"  HorizontalAlignment="Right" Width="9.773" Margin="0,0,0,0"><Run Text="۰۱"/></TextBlock>
                <TextBlock x:Name="Persian"  Margin="1,0,0,0" HorizontalAlignment="Left" Width="10"><Run Text="۰"/></TextBlock>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <Grid Margin="0,10,0,0">
        <Grid.DataContext>
            <XmlDataProvider x:Name="TeamData" Source="weekdays.xml" XPath="days/day" />
        </Grid.DataContext>
        <ListView x:Name="TeamsListBox" DockPanel.Dock="Left"
                     ItemsSource="{Binding}"
                     ItemTemplate="{StaticResource weekItemTemplate}"
                     IsSynchronizedWithCurrentItem="True"
                     Visibility="Visible" SelectionMode="Single" />
  • 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-14T08:45:51+00:00Added an answer on May 14, 2026 at 8:45 am

    Code-behind wants names to be statically resolvable. That said, if the names are really dynamic, how could you write code that depends on the names in all cases? Perhaps there is a way you can modify the design so that you don’t need to access the weekItem views directly, but can rather work with a class that models how the weekItem view behaves. For instance, if you need to register events or set certain properties, you could instead use a Command binding to a ‘WeekItemViewModel’ class and expose properties that reflect what you’d like the view to convey.

    Once you do this, you’ve eliminated your dependency on specific names, which means you can dynamically load your data and instantiate these WeekItemViewModel classes, which insulate you from the details of how the view is actually laid out. Your code can focus more on how it wants to interact and less on how you wire up the code-behind to your specific visuals.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have grid that gets created in the code behind. Grid has columns like
I have grid something like this: Ext.define('Exp.view.dashboard.Tv', { extend: 'Ext.grid.Panel', initComponent: function() { this.columns
I am using vb.net code. I have grid view, please see the code below:
I have a grid where first 2 columns are bound with ForeignKey (Category and
I have Grid with 10 rows and 10 column, and I want in code
I have grid with several editable cols colModel: [ { name: 'id', width: 1,
Hai presently i have grid like this. <Grid Name=tGrid1 Grid.Row=0 Background=Black > </Grid> <Grid
I have grid in my page which have four columns with multiple rows Userid
I have a Grid with 5 rows and 5 columns. I creating this Grid
I have grid view with three column name, rate, category I am also using

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.