2
I have a Datacontext set in a Cartesianchart which does not display the data... no error is displayed, just think I’m making wrong use of the Datacontext and I can’t fix it, I’m using the package Livechart-WPF
Xaml:
<lvc:CartesianChart x:Name="Teste" DataContext="{Binding}" Hoverable="False" Foreground="Black">
<lvc:CartesianChart.Series>
<lvc:ColumnSeries Title="{Binding OS}" Values="14" MaxWidth="1000" ColumnPadding="0" Foreground="Black"/>
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX>
<lvc:Axis Labels="{Binding DESCRICAO}" Foreground="Black">
<lvc:Axis.Separator>
<lvc:Separator Step="1"></lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
Codebehind:
private void LoadChart()
{
strConexao = ConfigurationManager.ConnectionStrings["BellaContext"].ConnectionString;
try
{
conn = new SqlConnection(strConexao);
conn.Open();
SqlCommand comm = new SqlCommand("SELECT * FROM PRODUTOS", conn);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
Teste.DataContext = dt.DefaultView;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
MessageBox.Show("Tudo Ok!");
}
}
Totally correct, thank you for the reply.
– Brewerton Santos
would have an example of the use of titles and subtitles?
– Brewerton Santos