私は、サードパーティのDevExpressライブラリでwpfとc#を使用しています。私はDXChartsに問題があります。私は、無駄にチャートをクリアまたは更新するために、いくつかの異なることを試しました。私は、Data-sourceの依存関係プロパティを持つData-Table(オンザフライで構築された)へのデータバインディングです。DXCharts(リフレッシュ、更新、クリア)を新しいインスタンスに分解しますか?
新しいデータがバッキングプロパティに設定されている場合、チャートの依存プロパティはオーバーライドされていないようです。これは私にグラフの上に重なるポイントを与えます。以下の例で分かります。
データの第一セット
データ
の第二セットIはまた、Chartコントロールの新しいインスタンスを作成し、そのはまだ古いバインドさ依存関係プロパティを示してみました。 DXchartのユーザーコントロールはコンテンツコントロールに組み込まれています。私はコンテンツプロパティを介してチャートをバインドします。これらはすべてDevExpressタブコントロールの下にネストされています。
依存関係プロパティ
public static readonly DependencyProperty DataTableChartProperty = DependencyProperty.Register
("DataTableChart", typeof(DataTable), typeof(MainWindowViewModel));
public static readonly DependencyProperty ContentElementProperty = DependencyProperty.Register
("ContentElement", typeof(FrameworkElement), typeof(MainWindowViewModel));
バッキングプロパティ
public DataTable DataTableChart
{
get { return (DataTable)this.GetValue(DataTableChartProperty); }
set { this.SetValue(DataTableChartProperty, value); }
public FrameworkElement ContentElement
{
get { return (FrameworkElement)this.GetValue(ContentElementProperty); }
set { this.SetValue(ContentElementProperty, value); }
}
のUserControl
:ここは、以下のコードの一部であります
<UserControl x:Class="Reporting_DIMS.UI.ChartControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="1100">
<Grid>
<Border Padding="3">
<dxc:ChartControl Margin="0" Name="chartControl" DataSource="{Binding DataTableChart}">
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D SeriesDataMember="DIMS User">
<dxc:XYDiagram2D.SeriesTemplate>
<dxc:BarSideBySideSeries2D ValueDataMember="Count" ArgumentDataMember="Entry DateTime" />
</dxc:XYDiagram2D.SeriesTemplate>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
<dxc:ChartControl.Legend>
<dxc:Legend x:Name="legend"/>
</dxc:ChartControl.Legend>
</dxc:ChartControl>
</Border>
</Grid>
小型メインウィンドウ部分
<dx:DXTabItem Header="Log Charts" Name="dXTabItem2">
<ContentControl x:Name="contentControl" Content="{Binding ContentElement}"/>
</dx:DXTabItem>
誰もが任意のアイデアを持っている場合、私はそれを大幅に感謝。前もって感謝します!
私は、依存関係のプロパティとはまったく無関係であるという問題を発見しました。新しいデータテーブルに移行されていたデータセットに失効したデータが残っていました。私はちょうど新しいインスタンスを作成し、すべてがうまくいきます。 – rreeves