Quantcast
Channel: ListView Headers not Binding?
Viewing all articles
Browse latest Browse all 4

ListView Headers not Binding?

$
0
0
     I have a ListView on my form and the columns for the listview look like this

<GridViewColumn Header="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Month1}" Width="79">

    So basically on my main window that the ListView is on I have a property called Month1, which is a string property. I want the header text to be bound to whatever is set in the property.  My property looks like this

publiceventEventHandler Month1Changed;
privatestring month1 = "Month 1";
publicstring Month1 { get { return month1; } set { month1 = value; if (Month1Changed != null) Month1Changed(this, newEventArgs()); } }

Now if I change the Month1 property in the Window1 Constructor it works fine and displays test in the month1 column.
public Window1()
{
InitializeComponent();
Month1 = "test";
}

If I try changing it somewhere else in the code it doesn't change

private
void loadMonthLabels()
{
Month1 = "test2";
}


So how can I change the Column Headers after the List View has already been loaded and displayed.

 


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images