First of all I must say that this may seem like a lot of code, but it is easy to read. I am trying to bind out some stuff and I get this as a result:
http://img694.imageshack.us/f/28475988.jpg/
As you can see, it seems like the number, description, line, and column have been duplicated.
On my main form designer I have:
<Window x:Class="Visual_Command_Line.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Visual_Command_Line"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="Visual Command Line" MinHeight="750" MinWidth="900" Loaded="Window_Loaded" Icon="/Visual_Command_Line;component/Resources/icon16x16.ico" WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing">
<Window.Resources>
<local:ErrorListCollection x:Key="ErrorList" />
</Window.Resources>
<dg:DataGrid Name="DataGrid_ErrorList" IsReadOnly="True" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding Source={StaticResource ErrorList}}">
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Binding="{Binding Path=GetNumber}" Header="" />
<dg:DataGridTextColumn Binding="{Binding Path=GetDescription}" Header="Description" Width="10*" />
<dg:DataGridTextColumn Binding="{Binding Path=GetLine}" Header="Line" Width="*" />
<dg:DataGridTextColumn Binding="{Binding Path=GetColumn}" Header="Column" Width="*" />
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>
When the main form loads I do:
((ErrorListCollection)this.FindResource("ErrorList")).RenewErrorList(((TabDocument)dockManager.ActiveDocument).currentAnalizedLine);
Here's the ErrorListCollection class:
class ErrorListCollection : ObservableCollection<DebugError>
{
public ErrorListCollection()
{
}
public void RenewErrorList(AnalizedLine al) //also all lines
{
this.Clear();
int currentAnalizedLine_lineNumber = al.lineNumber;
int errNumber = 1;
foreach (Boundaries b in al.GetBoundaries)
{
if (b.dataType == Boundaries.DataType.Unknown)
{
this.Add(new DebugError(errNumber, "d", "l", "c"));
errNumber++;
}
}
}
}
The DebugError class:
class DebugError
{
private int Number;
private string Description;
private string Line;
private string Column;
public int GetNumber
{
get
{
return this.Number;
}
}
public string GetDescription
{
get
{
return this.Description;
}
}
public string GetLine
{
get
{
return this.Line;
}
}
public string GetColumn
{
get
{
return this.Column;
}
}
public DebugError(int Number, string Description, string Line, string Column)
{
this.Number = Number;
this.Description = Description;
this.Line = Line;
this.Column = Column;
}
}
How can I fix these duplicates?
Try adding AutoGenerateColumn="False"
<dg:DataGrid Name="DataGrid_ErrorList" AutoGenerateColumns="False"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With