Hi,
In a WPF application,
I have to display data to a log window using data grid..
Every log message should be added to the logwindow and needs to be displayed.
My Xaml is :
<ListView x:Name="lstViewLogWindow" ItemsSource="{Binding}" Height="152" IsSynchronizedWithCurrentItem="True" MouseEnter="lstViewLogWindow_MouseEnter" MouseLeave="lstViewLogWindow_MouseLeave" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Foreground" Value="White"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView x:Name="grdViewLogWindow" >
<GridViewColumn x:Name="Message" Header="MessageDetails" Width="1000" DisplayMemberBinding="{Binding Path= MessageDetails}"/>
<GridViewColumn x:Name="LogDate" Header="DateTime" Width="275" DisplayMemberBinding="{Binding Path= DateTime}" />
</GridView>
</ListView.View>
</ListView>
I have a LogMessage.cs class as
public class LogMessage
{
public string Message_Name { get; set; }
public DateTime LogTime { get; set; }
}
In the code behind...
public void showmsg(string msg) {
List<LogMessage> messages = new List<LogMessage>();
messages.Add(new LogMessage() { LogTime = DateTime.Now, Message_Name = msg });
lstViewLogWindow.DataContext = messages;}
I am able to see the data available in the 'messages'... but I couldnt see it in the UI...
my presenter has _view.showmsg(msg)
........
But I cant see the data int he log window.. Please help.. thanks Ramm