2014-08-30 1 views
2

Xceed (Wpf 툴킷 확장 플러스)의 그래프 컨트롤에 바인딩하려고합니다.Xceed 차트에 바인딩

그러나, the documentation

그것은 일련의

데이터 포인트가 직접 데이터 포인트 속성을 사용하여 설정할 수 있습니다 말한다 ... 더 혼란 내게 남아있다, 그러나 그들은 또한 바인딩에 의해 설정 될 수 있습니다 Series 클래스의 DataPointsSource 속성을 소스로 가져온 다음 DataPointBindings를 DataPoint 클래스의 단일 속성에 대한 바인딩 정보를 저장하는 BindingInfo 개체로 채 웁니다. BindingInfo.Binding 속성을 사용하여 지정된 DataPoint 속성 (즉, 내용, 레이블, X 또는 Y)에 대한 Binding 개체를 설정하고 BindingInfo.PropertyName 속성 (형식은 DataPointPropertyName 임)을 사용하여 바인딩을 사용하도록 속성을 설정합니다.

그래서, 내 XAML은

<StackPanel.Resources> 
    <loc:BackupResultsViewModel x:Key="MyVm" /> 
    <CollectionViewSource x:Key="StatusCollection" Source="{Binding Source={StaticResource MyVm}, Path=MyData}" /> 
</StackPanel.Resources> 

<xctk:Chart Height="30" Width="300" ShowLegend="True" > 
    <xctk:Chart.Legend> 
    <xctk:Legend Dock="Left" AllowResize="False" AllowDock="True" AllowMove="True" Title="Legend"/> 
    </xctk:Chart.Legend> 

    <xctk:Chart.Areas> 
    <xctk:Area Title="Overall status" > 
     <xctk:Area.XAxis> 
     <xctk:Axis ShowAxisLabel="False" ShowTickLabels="False" ShowTicks="False"/> 
     </xctk:Area.XAxis> 

     <xctk:Area.YAxis> 
     <xctk:Axis ShowAxisLabel="False" ShowTickLabels="False" ShowTicks="False"/> 
     </xctk:Area.YAxis> 

     <xctk:Area.Series> 
     <xctk:Series Title="Overall status" DataPointsSource="{Binding Source={StaticResource StatusCollection}}"> 
      <xctk:Series.Layout> 
      <xctk:PieLayout /> 
      </xctk:Series.Layout> 

      <xctk:Series.DataPointBindings> 
      <xctk:BindingInfo PropertyName="Y"> 
       <xctk:BindingInfo.Binding> 
       <Binding/> 
       </xctk:BindingInfo.Binding> 
      </xctk:BindingInfo> 

      <xctk:BindingInfo PropertyName="X"> 
       <xctk:BindingInfo.Binding> 
       <Binding/> 
       </xctk:BindingInfo.Binding> 
      </xctk:BindingInfo> 

      <xctk:BindingInfo PropertyName="Label"> 
       <xctk:BindingInfo.Binding> 
       <Binding/> 
       </xctk:BindingInfo.Binding> 
      </xctk:BindingInfo> 
      </xctk:Series.DataPointBindings> 

     </xctk:Series> 
     </xctk:Area.Series> 
    </xctk:Area> 
    </xctk:Chart.Areas> 
</xctk:Chart> 

이며, 내 코드 뒤에 결코 모든 데이터와 함께,

public GraphViewModel() 
{ 
    this.Title = title; 

    var data = new DataPointsList<DataPoint>(); 
    data.Add(new DataPoint(0, 8, "0")); 
    data.Add(new DataPoint(1, 4, "1")); 
    data.Add(new DataPoint(2, 3, "2")); 
    data.Add(new DataPoint(3, 2, "3")); 

    this.MyData = data;   
} 

public DataPointsList<DataPoint> MyData { get; set; } 

그래프 쇼,하지만.

그렇다면 그래프를 사용하여 바인딩 작업을 수행하려면 어떻게해야합니까?

답변

2

이 그것을

<!-- ... --> 

    <xctk:BindingInfo PropertyName="Y"> 
    <xctk:BindingInfo.Binding> 
     <Binding Path="Y"/> <!--NOTE--> 
    </xctk:BindingInfo.Binding> 
    </xctk:BindingInfo> 

    <xctk:BindingInfo PropertyName="X"> 
    <xctk:BindingInfo.Binding> 
     <Binding Path="X"/><!--NOTE--> 
    </xctk:BindingInfo.Binding> 
    </xctk:BindingInfo> 

    <xctk:BindingInfo PropertyName="Label"> 
    <xctk:BindingInfo.Binding> 
     <Binding Path="Label"/><!--NOTE--> 
    </xctk:BindingInfo.Binding> 
    </xctk:BindingInfo> 
</xctk:Series.DataPointBindings> 
을한다
관련 문제