Problem with IsBackground/RimEffectEnabled

Gauge for WPF Forum

Posted 16 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Version: 4.5.0470
Platform: .NET 3.5
Environment: Windows Vista (64-bit)
Avatar
I have found a problem where changes to Background.Color or RimBrush.Color by a binding do not take immediate effect if IsBackgroundEffectEnabled or IsRimEffectEnabled are true. The changes seem to take effect if another property is changed. If IsXXXEffectEnabled is false, changes to the brush take effect immediately.

The problem can be easily reproduced with the following code:

<Window x:Class="WpfApplication1.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:gauge="http://schemas.actiprosoftware.com/winfx/xaml/gauge"
        Title="Window1" SizeToContent="WidthAndHeight" >

  <Window.Resources>
    <ControlTemplate x:Key="gaugeEditor">
      <Grid Margin="10">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="5"/>
          <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="5"/>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="5"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Content="Back"/>
        <TextBox Grid.Row="0" Grid.Column="2" MinWidth="100">
          <TextBox.Text>
            <Binding Path="Background.Color"
                     UpdateSourceTrigger="PropertyChanged"
                     ValidatesOnExceptions="True"/>
          </TextBox.Text>
        </TextBox>
        <CheckBox Grid.Row="0" Grid.Column="4" 
                  VerticalAlignment="Center" Content="Effect" 
                  IsChecked="{Binding IsBackgroundEffectEnabled}"/>

        <Label Grid.Row="2" Grid.Column="0" Content="Rim"/>
        <TextBox Grid.Row="2" Grid.Column="2" MinWidth="100">
          <TextBox.Text>
            <Binding Path="RimBrush.Color"
                     UpdateSourceTrigger="PropertyChanged"
                     ValidatesOnExceptions="True"/>
          </TextBox.Text>
        </TextBox>
        <CheckBox Grid.Row="2" Grid.Column="4" 
                  VerticalAlignment="Center" Content="Effect" 
                  IsChecked="{Binding IsRimEffectEnabled}"/>
      </Grid>
    </ControlTemplate>
  </Window.Resources>

  <StackPanel Orientation="Horizontal">
    <StackPanel>
      <gauge:CircularGauge x:Name="gauge1" Margin="10" 
                           Width="300" Height="200" Radius="100">
        <gauge:CircularGauge.Background>
          <SolidColorBrush Color="LightBlue"/>
        </gauge:CircularGauge.Background>
        <gauge:CircularGauge.RimBrush>
          <SolidColorBrush Color="DarkGreen"/>
        </gauge:CircularGauge.RimBrush>
      </gauge:CircularGauge>

      <ContentControl Template="{StaticResource gaugeEditor}" 
                      DataContext="{Binding ElementName=gauge1}"/>
    </StackPanel>

    <StackPanel>
      <gauge:LinearGauge x:Name="gauge2" Margin="10" 
                         Width="300" Height="200">
        <gauge:LinearGauge.Background>
          <SolidColorBrush Color="LightBlue"/>
        </gauge:LinearGauge.Background>
        <gauge:LinearGauge.RimBrush>
          <SolidColorBrush Color="DarkGreen"/>
        </gauge:LinearGauge.RimBrush>
      </gauge:LinearGauge>

      <ContentControl Template="{StaticResource gaugeEditor}" 
                      DataContext="{Binding ElementName=gauge2}"/>
    </StackPanel>

  </StackPanel>
</Window>
Simply update the color in one of the TextBoxes and observe the gauge does not update. Then uncheck the corresponding CheckBox and it will update. With the CheckBox still unchecked, update the Color again and the gauge should update immediately.

Note that for some frame types on a LinearGauge, changing RimBrush.Color does update part of the rim to the new color, but not all of it.

Phil

Comments (3)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Phil,

We found an issue with the Brush properties and have a fix ready for it. We are planning to update the Gauge product after the next maintenance release, so this fix will make it into that release.


Actipro Software Support

Posted 16 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Avatar
That's great, thanks!
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Phil,

This issue has been addressed with the v4.5.0480 release of WPF Studio.


Actipro Software Support

The latest build of this product (v24.1.2) was released 20 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.