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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:18:16+00:00 2026-06-12T00:18:16+00:00

So As you can see the ID column should be hidden but its not.

  • 0

So As you can see the ID column should be hidden but its not. And the debugger is showing the value of IDVisible in the xaml file to be “Hidden” but it never makes it to the window. I am calling a property changed method as well. What am I doing wrong, the ID column should disappear or at least that’s what I am trying to do.

MainWindow.xaml

And here is the code for MainWindowViewModel.cs

namespace MagicDB
{
class MainWindowViewModel : ObservableObject
{
    private CardDB _cards;
    private Command _InitCardDB;
    private Visibility _IDVisible;

    public CardDB Cards
    {
        get { return _cards; }
        set { _cards = value; OnPropertyChanged("Cards"); }
    }

    public Visibility IDVisible
    {
        get { return _IDVisible; }
        set { _IDVisible = value; VerifyPropertyName("IDVisible"); OnPropertyChanged("IDVisible"); }
    }

   public MainWindowViewModel()
    {
        IDVisible = Visibility.Hidden;
        _InitCardDB = new Command(InitDB, true);
        Cards = new CardDB();
    }

And the xaml file….

<Window x:Class="WpfDataGrid.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Width="500" Height="500">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="50" />
        <RowDefinition Height="450*" />
    </Grid.RowDefinitions>
    <DataGrid AutoGenerateColumns="False" 
        HorizontalAlignment="Left" 
        Name="dataGrid1" 
        VerticalAlignment="Top" 
        ItemsSource="{Binding Cards.cardDB}"
        CanUserReorderColumns="True"
              CanUserResizeColumns="True"
              CanUserResizeRows="False"
              CanUserSortColumns="True"
              AlternatingRowBackground="LightBlue"
              Width="480" Height="auto" Grid.Row="1" IsSynchronizedWithCurrentItem="True"  
              >
        <DataGrid.Columns>
            <DataGridTextColumn Header="ID" Binding="{Binding CardID}" Width="25" Visibility="{Binding IDVisible,Mode=TwoWay}"></DataGridTextColumn>
  • 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-12T00:18:17+00:00Added an answer on June 12, 2026 at 12:18 am

    I would check your Visible binding as it is most likely failing. This page explains a few methods that you can use. I personally prefer adjusting the trace level.

    I believe the reason that the binding is failing is due to the fact that your DataContext (I assume you have set it somewhere) isn’t getting to the DataGrid’s columns themselves. This page explains a fix that I have used in the past to solve this problem. I think I originally found that article from this page that has several other good to know WPF ‘Gotchas’.

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

Sidebar

Related Questions

I can see the Graphical Layout of the XML file within the /res/layout folder,
I can see that GD library is for images. But I can't see differences
I can see some potential difficulties with this concept but the idea is: I
I can see that Collections.unmodifiableSet returns an unmodifiable view of the given set but
Can anyone please suggest how should I implement column drag and drop (with auto
I got a Column Series that looks like this: As you can see i
I'm trying to write a Select statement where I can see if one column
I have a jqGrid, and one column should have a default value when adding
Say a table has several subclass types. How can I see all columns from
I can see it looks like an alias for an unsigned int pointer, right?

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.