<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Tech Off - How can I combine 2 ObservableCollections side by side?</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Mon, 20 May 2013 22:07:44 GMT</pubDate>
	<lastBuildDate>Mon, 20 May 2013 22:07:44 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>6</c9:totalResults>
	<c9:pageCount>-6</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<description><![CDATA[<p>I have a lot of different ObservableCollections.&nbsp; They all have the same number of elements and grow together as new data arrives.&nbsp; They have different properties and I would like to be able to combine them together for use in charting and several datagrids using databinding.&nbsp; Is there an easy way to do this without coping all of the data to&nbsp;new ObservableCollections.&nbsp; The user will be able to select which ones they want to compare and bring them up for viewing.</p><p>Thanks</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/48588cbb90d643968a38a1240009aa9f#48588cbb90d643968a38a1240009aa9f</link>
		<pubDate>Tue, 11 Dec 2012 00:35:11 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/48588cbb90d643968a38a1240009aa9f#48588cbb90d643968a38a1240009aa9f</guid>
		<dc:creator>Blunderbore</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Blunderbore/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<description><![CDATA[<p>Hi,</p><p>You can copy them to HashSet&lt;T&gt; and then do all the possible Set theory operations on them like Union, Intersection, etc. without writing the code for it yourself.</p><p>HashSet&lt;T&gt; has a parameterized constructor that accepts an IEnumerable&lt;T&gt;, so you can copy the data easily.</p><p><pre class="brush: text">
HashSet&lt;Foo&gt; hashSet1 = new HashSet&lt;Foo&gt;(myObservableCollection1);

HashSet&lt;Foo&gt; hashSet2 = new HashSet&lt;Foo&gt;(myObservableCollection2);

hashSet1.UnionWith(hashSet2);

hashSet1.IntersectionWith(hashSet2);</pre></p><p>&nbsp;</p><p>and so on.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/fcdc5c1e6ba7488a99d7a12400eeedb0#fcdc5c1e6ba7488a99d7a12400eeedb0</link>
		<pubDate>Tue, 11 Dec 2012 14:29:54 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/fcdc5c1e6ba7488a99d7a12400eeedb0#fcdc5c1e6ba7488a99d7a12400eeedb0</guid>
		<dc:creator>Sathyaish Chakravarthy</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Sathyaish Chakravarthy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<description><![CDATA[<p>Thanks for your response.&nbsp; But I do not think HashSet will work for me.&nbsp; I have provided additional info below.</p><p>I have done a lot of studying on this and I believe that I now have a better understanding of what I need and how I should ask the question.&nbsp; Although I have many, for the sake of simplicity I will only refer to 2 classes here as an example.&nbsp; I am gathering data in real time.&nbsp; The data is being processed and placed into ObservableCollection classes.&nbsp; All classes will have the same number of data points.&nbsp; Any class can have many duplicates.&nbsp; The order of the data must not change.&nbsp; I am looking for a way to somehow merge multiple classes together side by side so the resulting class can be used as a single data source with all properties combined when data binding to a WPF chart or datagrid.&nbsp; I would like to do this without have to copy all of the data to the new object, something like a data view.&nbsp; Here's what I mean by &quot;merge multiple classes together side by side&quot;.&nbsp;</p><p>Starting with 2 ObservableCollection classes.&nbsp; The first ObservableCollection is of objects with properties A, B and C and the second ObservableCollection is of objects with properties D and E. &nbsp;I would like to be able to combine them into a single data source of A, B, C, D and E. &nbsp;Hopefully as some kind of data view where the underlining data is accessed but not copied. &nbsp;It seems that CompositeCollection just puts them on top of each other.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/ff7bfdf0b4a649bca6d5a125005d000a#ff7bfdf0b4a649bca6d5a125005d000a</link>
		<pubDate>Wed, 12 Dec 2012 05:38:36 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/ff7bfdf0b4a649bca6d5a125005d000a#ff7bfdf0b4a649bca6d5a125005d000a</guid>
		<dc:creator>Blunderbore</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Blunderbore/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<description><![CDATA[<p>@<a href="/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side#cff7bfdf0b4a649bca6d5a125005d000a">Blunderbore</a>: I don't <em>think</em> there's a built-in mechanism for this.</p><p>Because you store the data in classes (rather than in&nbsp;primitives&nbsp;like int or double), then when you 'copy' the data to a new collection, you are not actually copying the whole data, only a reference to the data; this means that copying is less of a problem.</p><p>If you want to combine the contents of two separate classes into a single source, then you can create a 'wrapper' class that takes two objects in it's constructor and exposes their properties as it's own. e,g,:</p><p>&nbsp;</p><p><pre class="brush: csharp">public class Wrapper
{
    private ClassA _a;
    private ClassB _b;

    public Wrapper(ClassA a, ClassB b)
    {
        _a = a;
        _b = b;
    }

    public double A
    {
        get
        {
            return _a.A;
        }
        set
        {
            _a.A = value;
        }
    }

    // ... also for properties B, C &amp; D

    public double E
    {
        get
        {
            return _b.E;
        }
        set
        {
            _b.E = value;
        }
    }
}</pre></p><p>&nbsp;</p><p>This means you're not duplicating the original data (it's still sits in the original classes) but you can treat the wrapper class as a combined view.</p><p>However, you are going to have to manually create a new collection of these wrapper classes to present the new data for databinding.</p><p>&nbsp;</p><p>Herbie</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/63a5d97c93c94a9a8abca125007e7229#63a5d97c93c94a9a8abca125007e7229</link>
		<pubDate>Wed, 12 Dec 2012 07:40:22 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/63a5d97c93c94a9a8abca125007e7229#63a5d97c93c94a9a8abca125007e7229</guid>
		<dc:creator>Herbie Smith</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Dr Herbie/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<description><![CDATA[<p>Thanks Herbie for your response.&nbsp; I have tried this and many other permutations.&nbsp; I have been unable to get the Wrapper class to look and act like a single ObservableCollection to the rest of the system.&nbsp; Change notifications did not seem to get through the Wrapper and the pointer to which object within the ObservableCollections was not staying in sync.&nbsp; I tried all kinds of things adding band aids to the point that it was so convoluted that I could no longer follow what was happening. &nbsp;It seemed to me that as extensive as the .NET framework is that this feature would be there somewhere.&nbsp; I just did not know what to call it or where to look.&nbsp; So I asked this question.&nbsp; Maybe I'm the only one that needs to bring data together like.</p><p>Any additional help or ideas would be greatly appreciated.</p><p>Blunderbore</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/c3537639cc224609bed5a125011b1eeb#c3537639cc224609bed5a125011b1eeb</link>
		<pubDate>Wed, 12 Dec 2012 17:10:48 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/c3537639cc224609bed5a125011b1eeb#c3537639cc224609bed5a125011b1eeb</guid>
		<dc:creator>Blunderbore</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Blunderbore/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - How can I combine 2 ObservableCollections side by side?</title>
		<description><![CDATA[<p>What about using zip.</p><p><pre class="brush: vb">col_A.Zip(col_B, Function(a,b) {a,b})</pre></p><p>or using RX?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/f696d73f1cf74eaab954a12701648a78#f696d73f1cf74eaab954a12701648a78</link>
		<pubDate>Fri, 14 Dec 2012 21:38:07 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/How-can-I-combine-2-ObservableCollections-side-by-side/f696d73f1cf74eaab954a12701648a78#f696d73f1cf74eaab954a12701648a78</guid>
		<dc:creator>Adam Speight</dc:creator>
		<slash:comments>6</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/AdamSpeight2008/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>