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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:47:08+00:00 2026-06-10T09:47:08+00:00

can i create a view at design time, using dynamic objects? (with visual studio

  • 0

can i create a view at design time, using dynamic objects? (with visual studio 2010)

for example, or something, is that possible?

         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:dyn="clr-namespace:System.Dynamic;assembly=System.Core"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         mc:Ignorable="d" 

and

<d:DesignProperties.DataContext>
    <dyn:ExpandoObject>
        <dyn:ExpandoObject.Name>MyName</dyn:ExpandoObject.Name>
    </dyn:ExpandoObject>
</d:DesignProperties.DataContext>

The above example does not work.

Sometimes I have class complicated to manage. And I can not use them at design time, the idea of using a dynamic type would be not to change the bindings (properties that I will use) and get a vision.

I do not know if I was clear, but if you have something that can help me would be great.

  • 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-06-10T09:47:09+00:00Added an answer on June 10, 2026 at 9:47 am

    That should not work in any case, be it design or run-time.

    You can use ExpandoObjects, but only via dictionary syntax:

    <dyn:ExpandoObject>
        <sys:String x:Key="Name">MyName</sys:String>
    </dyn:ExpandoObject>
    

    Though i do not know if that junk of a GUI designer is able to handle that, nor do i know if this works with compiled XAML.

    Edit: As i thought you cannot compile this because some component fails:

    Error 1 The Key attribute can only be used on a tag contained in a Dictionary (such as a ResourceDictionary).

    Well, it is a bloody dictionary alright…


    You can use a markup extension though, you can get the DictionaryFactoryExtension from this answer and modify it like this:

    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        var expando = (IDictionary<string,object>)new ExpandoObject();
        foreach (DictionaryEntry kvp in Dictionary)
            expando[(string)kvp.Key] = kvp.Value;
    
        return expando;
    }
    
    //The designer uses this for whatever reason...
    public object this[object key]
    {
        get { return this.Dictionary[key]; }
        set { this.Dictionary[key] = value; }
    }
    

    Then you can use that just like an ExpandoObject:

    <!-- Of course you can also hard-code the key-type in the class,
         it should be a string in all cases when using an ExpandoObject anyway -->
    <local:DictionaryFactory KeyType="sys:String" ValueType="sys:Object">
        <sys:String x:Key="Name">MyName</sys:String>
    </local:DictionaryFactory>
    

    The designer should be able to handle this.

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

Sidebar

Related Questions

How can create a view with mutiple images, something similiar to the photo app
How can I create View on Linked Server db. For Example I have a
How can I create a basic UIButton programmatically? For example in my view controller,
I'm trying to create a view that only houses reusable HTML blocks that can
I'm building a jar so that other developers can use the view I create
I am trying to create a custom popup view that can be called from
How can I dynamically create a view controller with a NIB file? Thanks.
In OS3.1.3, I can create 6 UIWebView in a single view to watch 6
How can I create multiple dropdowns in my view with values coming from my
I am trying to create a pdf viewer but I can't separate view from

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.