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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:13:22+00:00 2026-05-26T22:13:22+00:00

I have several controls in my WPF window. I have divided the window into

  • 0

I have several controls in my WPF window. I have divided the window into 4 sections. If I click on the section in the upper left, I want to copy the contents of this section in another window popup.
What I want to copy is a grid that can contain a lot of different controls, ex: togglebutton, button, panel… derived from ItemsControl, Control… and with DependencyProperty, ObservableCollection etc..

I tried :

  • XamlWriter.Save(data);
  • XamlServices.Save(data);

but I always have these errors :

  • Cannot serialize a generic type ‘System.Collections.ObjectModel.ObservableCollection`1 or
  • A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure
    genericTypeArguments and genericMethodArguments are provided and
    contain enough context.
  • 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-26T22:13:22+00:00Added an answer on May 26, 2026 at 10:13 pm

    You should not clone XAML itself, this is brutal and wrong way.

    Take a look at the possible MVVM solution below. Let’s say single DataGird represents a single business Item, so you need following:

    • ItemsWindow.xaml – represents a ListView and single item of ListView is DataGrid representing an item details
    • ItemsViewModel – expose list of Item objects (ObservableCollection<Item> Items { get; set; })
    • Each item of the ItemsWindow.ListView is represented by a DataTemplate like ItemDataTemplate
    • ItemsViewModel exposed command ICommand CopyItem and in command handler actually copyiing only instance of the Item business entity and adding it to the Items list, WPF reflects this changes via bindings and UI will be updated by a new ListViewItem with a DataGrid representing a details of just copied Item

    Useful links:

    • Model View ViewModel pattern
    • Commands
    • Data Templating Overview – short and clean overview of WPF data templates with examples
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application which has a main window composed from several custom
I hope this makes sense. I have created several WPF User Controls. The lowest
I have a Window with several Frame controls and would like to find the
I want to have the WPF controls inherited like this, public class BaseView :
In my WPF application, I have a Stackpanel containing several controls inside them. How
I have several controls on my form and on changed event the logic entity
I have several user controls, let's say A , B , C and D
I have several server controls that implement the IValidator interface. As such, they have
I have a situation where I have several listbox controls on the same asp.net
I have several ASP:TextBox controls on a form (about 20). When the form loads,

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.