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 6071783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:05:12+00:00 2026-05-23T10:05:12+00:00

I have a form, it has a grid. I autogenerate the columns and tweak

  • 0

I have a form, it has a grid.

I autogenerate the columns and tweak them as required:

    if (e.PropertyName == "id")
    {
        System.Windows.Style style = new Style(typeof(DataGridCell));
        style.Setters.Add(new Setter(DataGridCell.ContentTemplateProperty, CreateBtnTemplate(30)));
        e.Column.CellStyle = style;
    }
    private static DataTemplate CreateBtnTemplate(int width)
    {
        string str = "<DataTemplate xmlns='http://schemas.microsoft.com/client/2007' >"
                      //+ "<Button Tag='{Binding id}' Content='Respond'                 
                      + "<Button Tag='{Binding id}' Content='Respond' "
                      + "Visibility='{Binding id,  Converter={StaticResource myConverter}}'"
                      + " />"
                      + "</DataTemplate>";
        return (DataTemplate)XamlReader.Load(str);
    }

In my pages xaml, I have:

<Grid x:Name="LayoutRoot" Margin="0,0,4,0">
    <Grid.Resources>
        <my:EnableDisableConverter x:Name="myConverter" x:Key="myConverter"></my:EnableDisableConverter>
    </Grid.Resources>

My class looks like:

public class EnableDisableConverter : IValueConverter
{
    object IValueConverter.Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        Service1failedbackups f = value as Service1failedbackups;
        if (f.resolution == null || f.resolution == "")
            return System.Windows.Visibility.Visible;
        else
            return System.Windows.Visibility.Collapsed;
    }
    object IValueConverter.ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {        return null;
    }
}

In short, if the content of “resolution” is blank, I want a button so I it can be filled in, via a popup window.

Now, it all compiles, it all looks good.
(my is defined as

xmlns:my="clr-namespace:SilverlightApplication1"

as part of the page header.

The error I get is:

Error: Unhandled Error in Silverlight Application 
Code: 2272    
Category: ParserError       
Message: Cannot find a Resource with the Name/Key myConverter     
File:      
Line: 1     
Position: 121     

Now, its all OK until I put the visibility part of my btnTemplate in. I’ve used the ID column specifically because, I dont need users to see it.

Please, can someone tell me what I missed. This is driving me nuts.

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

    I fixed it

    Heres how.

    in my xaml file I added

    xmlns:converter="clr-namespace:SilverlightApplication1"
    

    and then under grid I added

        <converter:EnableDisableConverter x:Name="myConverter" x:Key="myConverter" />
        <DataTemplate x:Key="DataTemplate" >
            <Button Visibility='{Binding Converter={StaticResource myConverter}}' Content='Respond' Click="btnRespond_Click" />
        </DataTemplate>
        <DataTemplate x:Key="err" >
            <TextBlock Text='{Binding err}' FontSize='8'  TextWrapping='Wrap'/>
        </DataTemplate>
        <DataTemplate x:Key="resolution" >
            <TextBlock Text='{Binding resolution}' FontSize='8'  TextWrapping='Wrap'/>
        </DataTemplate>
    </Grid.Resources>
    

    I then ditched all the auto generating of my columns and set

        <sdk:DataGrid.Columns>
            <sdk:DataGridTemplateColumn  CellTemplate="{StaticResource DataTemplate}" Header="Action" Width="Auto" />
            <sdk:DataGridTextColumn Binding="{Binding server}"  Header="server" Width="Auto" />
            <sdk:DataGridTextColumn Binding="{Binding software}"  Header="software" Width="Auto" />
            <sdk:DataGridTextColumn Binding="{Binding backupgroup}"  Header="backupgroup" Width="Auto" />
            <sdk:DataGridTemplateColumn  CellTemplate="{StaticResource err}" Header="Action" Width="250" />
            <sdk:DataGridTemplateColumn  CellTemplate="{StaticResource resolution}" Header="Action" Width="150" />
            <sdk:DataGridTextColumn Binding="{Binding resolver}"  Header="resolver" Width="Auto" />
        </sdk:DataGrid.Columns>
    

    NOW it works. NOW it flipping works..
    hurrah

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

Sidebar

Related Questions

I have a form that has 8 columns and a variable number of rows
I Have a Windows Form Project , which has a main form,and in this
I have a form, this form has a submit and a cancel button. when
I have a form with a table source, the form has a few fields
I have a form that has multiple fields, and for testing purposes is there
I have a form that has a public property public bool cancelSearch = false;
I have a form which has only tab control in it. I want to
I have a form that has a group of 3 text_fields. I need two
I have a form which has a Combo Box Control. I have selected the
I have a form that has many long-methods. My quest is: What is the

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.