Reputation: 7299
I am so new in WPF ,i am trying to draw a map using WPF
so i fetch the points from database as you can see here :
lstSensorLeft = objSensorRepository.FindBy(i => i.Path.LineId == 1 && i.Direction == "Left").OrderBy(i => i.Order).ToList();
PointCollection obj = new PointCollection();
foreach (Sensor point in lstSensorLeft)
{
Point aaa=new Point();
aaa.X = point.XLocation;
aaa.Y = point.YLocation;
}
Lines.Points = obj;
In Xaml part i have this code :
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500*"/>
<ColumnDefinition Width="93*"/>
</Grid.ColumnDefinitions>
<Polyline Stroke="Blue" StrokeThickness="2" Name="Lines" Grid.ColumnSpan="2"/>
<Button Content="Button" HorizontalAlignment="Left" Margin="74,283,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_2"/>
</Grid>
But the lines don't appear.
Upvotes: 0
Views: 186
Reputation:
Inside your foreach
loop, you do not add the new point to the collection. E.g. something like this is missing:
obj.Add(aaa);
Upvotes: 1