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

  • SEARCH
  • Home
  • 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 7440071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:47:46+00:00 2026-05-29T10:47:46+00:00

I have the following converter defined (C#): class BodyValueConverter : IValueConverter { public object

  • 0

I have the following converter defined (C#):

class BodyValueConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        string s = value.ToString();
        int prefixLength;
        if (!int.TryParse(parameter.ToString(), out prefixLength))
            return s;
        return s.Substring(0, prefixLength);
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}

This will start at the start of the string being passed and will return the amount of characters I specify as a parameter.

In my XAML I have instanced the converter:

<local:BodyValueConverter x:Key="BodyValueConverter"/>

In attempting to use this converter in a textblock I get an error:

<DataTemplate x:Key="AppointmentTemplate">
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Subject}"></TextBlock>
        <TextBlock Text="{Binding Path=Subject, Converter={StaticResource BodyValueConverter}, ConverterParameter=1}"></TextBlock>
    </StackPanel>
</DataTemplate>

The error is:

XAMLParseException: Provide value on ‘System.Windows.Markup.StaticResourceHolder’ threw an exception.

The first textblock works fine to display subject. The 2nd line is what gives me the exception.

  • 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-29T10:47:47+00:00Added an answer on May 29, 2026 at 10:47 am

    What’s the order of your objects in your XAML?

    The Converter has to be defined prior to actually being used, so be sure your <Converter> is above your <DataTemplate> in your Resources

    Another alternative is to switch to using a DynamicResource instead of a StaticResource, since a DynamicResource is evaluated when it is needed, not when the XAML is loaded

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following converter: public class MyConverter : IValueConverter { public object Convert(object
I have defined the following CComPtr object and method in my class: private: CComPtr<IRawPdu>&
I have the following IComparer defined for boxed RegistryItem objects: public class BoxedRegistryItemComparer :
I have the following property defined: @Entity @Table(name = person) public class Person extends
I have the following bean defined: <bean id=myBean class=com.me.myapp.Widget> <constructor-arg name=fizz value=null/> <constructor-arg name=buzz
I have the following code to convert the type of the matrix using cv::Mat.convertTo()
I have a function like the following: // Convert To JPG // public string
Each time I use Merge() I have the following: 'Cannot implicitly convert type 'void'
I have a Software titles class which is defined as follows: public class SoftwareTitles
I've defined the following classes public class AbstractManager<E> { public E save(E o) {

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.