in

Software FX Community

Discuss and find help for all Software FX products.

ConditionalAttributes not working in DataTemplate

Last post 03-17-2008 11:10 AM by JuanC. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-14-2008 7:51 PM

    ConditionalAttributes not working in DataTemplate

    I've encountered a problem where a ConditionalAttribute on my Chart works fine when the Chart is defined in the normal body of the Xaml.  The ConditionalAttributes are completely ignored when used on a Chart defined in a DataTemplate though.  Working and non-working examples are shown below, and suggestions would be appreciated.

     

    <Window x:Class="ChartFXSandbox.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cfx="clr-namespace:ChartFX.WPF;assembly=ChartFX.WPF"
        Title="ChartFXSandbox" Height="800" Width="1024"
        >
      <Window.Resources>
        <XmlDataProvider x:Key="ChartData" XPath="/Coordinates/Coordinate">
          <x:XData>
            <Coordinates xmlns="">
              <Coordinate>
                <Domain>1</Domain>
                <Range>2</Range>
              </Coordinate>
              <Coordinate>
                <Domain>2</Domain>
                <Range>4</Range>
              </Coordinate>
              <Coordinate>
                <Domain>3</Domain>
                <Range>6</Range>
              </Coordinate>
              <Coordinate>
                <Domain>4</Domain>
                <Range>8</Range>
              </Coordinate>
              <Coordinate>
                <Domain>5</Domain>
                <Range>10</Range>
              </Coordinate>
            </Coordinates>
          </x:XData>
        </XmlDataProvider>

        <DataTemplate x:Key="ChartDataTemplate" DataType="ChartData">
          <cfx:Chart ItemsSource="{Binding Source={StaticResource ChartData}}" Gallery="Line">
            <cfx:SeriesAttributes BindingPath="Range" BindingPathX="Domain"/>
            <cfx:Chart.ConditionalAttributes>
              <cfx:ConditionalAttributes Fill="Blue">
                <cfx:ConditionalAttributes.Condition>
                  <cfx:RangeCondition From="3" To="9" BindingPath="Range"/>
                </cfx:ConditionalAttributes.Condition>
              </cfx:ConditionalAttributes>
            </cfx:Chart.ConditionalAttributes>     
          </cfx:Chart>
        </DataTemplate>
       
      </Window.Resources>

      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition/>
          <RowDefinition/>
        </Grid.RowDefinitions>
        <ContentControl Grid.Row="0" Content="{Binding Source={StaticResource ChartData}}" ContentTemplate="{StaticResource ChartDataTemplate}" />
       
        <ContentControl Grid.Row="1">
          <cfx:Chart ItemsSource="{Binding Source={StaticResource ChartData}}" Gallery="Line">
            <cfx:SeriesAttributes BindingPath="Range" BindingPathX="Domain"/>
            <cfx:Chart.ConditionalAttributes>
              <cfx:ConditionalAttributes Fill="Blue">
                <cfx:ConditionalAttributes.Condition>
                  <cfx:RangeCondition From="3" To="9" BindingPath="Range"/>
                </cfx:ConditionalAttributes.Condition>
              </cfx:ConditionalAttributes>
            </cfx:Chart.ConditionalAttributes>
          </cfx:Chart>
        </ContentControl>
      </Grid>
    </Window>

  • 03-17-2008 11:10 AM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: ConditionalAttributes not working in DataTemplate

    We recently discovered this issue and it has been fixed in our current build. If you want to test it please send an email to wpf at softwarefx dot com to request a hotfix.

    Regards,

    JuanC

Page 1 of 1 (2 items)
Copyright 2008 Software FX, Inc.