Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 683459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:42:34+00:00 2026-05-14T01:42:34+00:00

I have a WPF UI that is bound to an object. I’m using a

  • 0

I have a WPF UI that is bound to an object. I’m using a ValueConverter to convert a property to a specific image by a business rule:


    public class ProposalStateImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var proposal = value as Proposal;
            var basePath = "pack://application:,,,/ePub.Content;component/Images/General/Flag_{0}.png";
            string imagePath;

            if(proposal.Invoice != null)
            {
                imagePath = string.Format(basePath, "Good");
            }
            else
            {
                imagePath = string.Format(basePath, "Warning");
            }

            var uri = new Uri(imagePath);
            var src = uri.GetImageSource(); //Extention method

            return src;
        }
    }

The element is a TreeView where the image is on the 2nd level:


    <TreeView x:Name="tree"
              ItemsSource="{Binding People}" 
              SelectedItemChanged="OnTreeItemChanged">
        <TreeView.Resources>
            <HierarchicalDataTemplate DataType="{x:Type dmn:Person}" 
                                      ItemsSource="{Binding Proposals}">
                <StackPanel Orientation="Horizontal" ToolTip="{Binding Path=Fullname}" Margin="3">
                    <Image Margin="5,0,5,0" Width="16" Height="16" Source="pack://application:,,,/ePub.Content;component/Images/General/Person_Active.png" />
                    <TextBlock Text="{Binding Path=Firstname}" />
                    <TextBlock Text="{Binding Path=Lastname}" Margin="5,0,0,0" />
                </StackPanel>
            </HierarchicalDataTemplate>
            <HierarchicalDataTemplate DataType="{x:Type dmn:Proposal}">
                <StackPanel Orientation="Horizontal" Margin="3">
                    <Image x:Name="invoiceImage" Width="16" Height="16" Margin="5,0,5,0" Source="{Binding, Converter={StaticResource ProposalStateImageConverter}, UpdateSourceTrigger=PropertyChanged}" />
                    <TextBlock Text="{Binding DeliveryDate, Converter={StaticResource textCulturedDateConverter}}" />
                </StackPanel>
            </HierarchicalDataTemplate>
        </TreeView.Resources>
    </TreeView>

It is working fine, but later, when the object’s state changes, I want to refresh the image and make the value converter reevaluate. How is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:42:35+00:00Added an answer on May 14, 2026 at 1:42 am

    It looks like you’re only using a single value inside the converter and you’re just doing a simple switch between two values so you could instead just do this directly in XAML with a trigger. This method also switches to a Binding against the Invoice property so that any change notifications for that property will cause the Trigger to update.

    <HierarchicalDataTemplate >
        <StackPanel Orientation="Horizontal" Margin="3">
            <Image x:Name="invoiceImage" Width="16" Height="16" Margin="5,0,5,0" Source="good.png"/>
            <TextBlock ... />
        </StackPanel>
        <HierarchicalDataTemplate.Triggers>
            <DataTrigger Binding="{Binding Invoice}" Value="{x:Null}">
                <Setter TargetName="invoiceImage" Property="Source" Value="warning.png"/>
            </DataTrigger>
        </HierarchicalDataTemplate.Triggers>
    </HierarchicalDataTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF ListView that is bound to a BindingList<T>. The binding works
I have run into an issue with WPF and Commands that are bound to
I have a WPF application that runs fine under XP as an administrator. When
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
This is an interesting conundrum. We have a WPF app that has a Vista-like
I have a ListView in WPF that is databound to a basic table that
I have written a WPF application that I want to port to Silverlight 2.
I have a simple WPF (XAML) file that has some animated shapes and text.
I have a WPF control, that has a list of Investors, and in the
I have a simple message box in a WPF application that is launched as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.