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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:03:50+00:00 2026-06-15T17:03:50+00:00

I have a DataGrid , follow the XAML : <DataGrid ItemsSource={Binding Path=propCollection} SelectedItem={Binding Path=SelectProp,

  • 0

I have a DataGrid, follow the XAML :

    <DataGrid ItemsSource="{Binding Path=propCollection}"
              SelectedItem="{Binding Path=SelectProp, Mode=TwoWay}"
              Margin="-1,159,0,0" 
              RowDetailsVisibilityMode="Visible" 
              AreRowDetailsFrozen="False" 
              CanUserReorderColumns="False" 
              CanUserSortColumns="True" 
              CanUserResizeRows="False"  
              SelectionUnit="FullRow" 
              AlternatingRowBackground="{x:Null}" 
              SelectionChanged="dgProprietarios_SelectionChanged"
              AlternationCount="0"
              Height="200" 
              HorizontalAlignment="Left"
              Name="dgProprietarios" 
              VerticalAlignment="Top" 
              Width="645" 
              AutoGenerateColumns="False">
                 <...Columns...>
    </DataGrid>

On my Window_Loaded I do the following :

dgProprietarios.DataContext = new ProprietariosViewModel(new Dictionary<string, string>());

My ProprietariosViewModel is the following :

public CollectionProprietarios propCollection { get; set; }

public ProprietariosViewModel(Dictionary<string, string> Where)
{
    propCollection = new CollectionProprietarios(Where);
}

The CollectionProprietarios class inherits ObservableCollection and have the following code :

    public CollectionProprietarios(Dictionary<string, string> Where)
    {
        Add(new Dados(Where));
    }

    public new void Add(Dados dados)
    {
        base.Add(dados);
    }

The class Dados have the following code :

public DataTable ProprietariosRetorno { get; private set; }

public Dados(Dictionary<string, string> Where)
{

    var ado = new ADO();
    ProprietariosRetorno = ado.RetornaSelect(MontaQuery(Where));

}

The function MontaQuery just creates a string that contains a SELECT clause and RetornaSelect executes this Query.

The class ADO, when instanciated just creates the database and the table if it doesn’t exist.

The problem is, all of that is working. While debugging, I can retrieve the value inside the DataContext and it contains the DataTable with values. But for some reason, it doesn’t appear on the DataGrid when the program is running.

So the question is, what am I doing wrong ?

  • 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-15T17:03:51+00:00Added an answer on June 15, 2026 at 5:03 pm

    Try to use

    dgProprietarios.DataContext = new ProprietariosViewModel(new Dictionary<string, string>());
    dgProprietarios.Items.Refresh();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a datagrid declared in the xaml as follows: <sdk:DataGrid x:Name=ProductsForProjectDataGrid AutoGenerateColumns=True ItemsSource={Binding
I have a datagrid with master detail implementation as follows: <data:DataGrid x:Name=dgData Width=600 ItemsSource={Binding
I have a datagrid defined in XAML as follows: <toolkit:DataGrid Margin=10,116,62,34 Name=WADataGrid RowBackground=LightYellow AlternatingRowBackground=White
I have a DataGrid which is as follows:: <wpfkit:DataGrid AutoGenerateColumns=False ItemsSource={Binding} Width=Auto FrozenColumnCount=2 SelectionMode=Extended
I have an XAML tree as follows: <Window> <Grid> <DockPanel> <DataGrid> <DataGrid.Resources> <CheckBox Command={Binding
In my wpf app, I have a datagrid as follows <Custom:DataGrid x:Name=dg_nba IsEnabled={Binding Iseditmode}
I have a DataGrid (WPF 4) like this: <DataGrid Margin=0,0,0,5 VerticalAlignment=Top Height=192 BorderBrush=#aaa Background=White
I have datagrid whichs items source is domainDataSource. How i can refresh Domain data
I have a datagrid in C#.net I have made some columns in grid editable.
I have a DataGrid with a CheckBox column. I show a popup if 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.