<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How do I apply more than one filter?</title>
	<atom:link href="http://bea.stollnitz.com/blog/?feed=rss2&#038;p=32" rel="self" type="application/rss+xml" />
	<link>http://bea.stollnitz.com/blog/?p=32</link>
	<description>on Silverlight and WPF</description>
	<lastBuildDate>Thu, 22 Jul 2010 20:56:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bea</title>
		<link>http://bea.stollnitz.com/blog/?p=32&#038;cpage=1#comment-371</link>
		<dc:creator>Bea</dc:creator>
		<pubDate>Wed, 19 Sep 2007 01:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=32#comment-371</guid>
		<description>Hi Susan,

Have you tried using a MultiBinding in the Source property of the CollectionViewSource? Within that MultiBinding, you can have a Binding per column that you&#039;re interested in. You will need to write a MultiBinding Converter that takes all the different data items you bind to as parameters. As the return value, I would probably create a custom object with a property for each of the data items you care about. You will also need to change your DataTemplate so that it understands the custom object you returned from the MultiBinding Converter.

Let me know if this makes sense.

Bea</description>
		<content:encoded><![CDATA[<p>Hi Susan,</p>
<p>Have you tried using a MultiBinding in the Source property of the CollectionViewSource? Within that MultiBinding, you can have a Binding per column that you&#8217;re interested in. You will need to write a MultiBinding Converter that takes all the different data items you bind to as parameters. As the return value, I would probably create a custom object with a property for each of the data items you care about. You will also need to change your DataTemplate so that it understands the custom object you returned from the MultiBinding Converter.</p>
<p>Let me know if this makes sense.</p>
<p>Bea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shao</title>
		<link>http://bea.stollnitz.com/blog/?p=32&#038;cpage=1#comment-111</link>
		<dc:creator>shao</dc:creator>
		<pubDate>Wed, 05 Sep 2007 11:44:24 +0000</pubDate>
		<guid isPermaLink="false">http://bea.stollnitz.com/blog/?p=32#comment-111</guid>
		<description>shao said... 
Hi,
I&#039;ve been trying to create filters for a scattered plot graph where the data is binding to a xml file. The problem I&#039;m encountering is that when I create my CollectionViewSource, it looks like this: 

[CollectionViewSource x:Key=&quot;DataView&quot; Source=&quot;{Binding Source={StaticResource tableDS}, XPath=/table/row/column.5}&quot; /]

Since I need column.5 is the one I need to filter out information from to determine whether this node should appear on the graph or not, I am passing the XPath /table/row/column.5, however, I need other columns to construct my ellipses in my graph. For example, the size of each of the ellipse is based on column.4 and its coordinates are based on column.2 and column.3. 

This is my DataTemplate:
[DataTemplate x:Key=&quot;rowTemplate&quot; ]
[Ellipse Stroke=&quot;#FF979798&quot; Width=&quot;{Binding Converter={StaticResource convertSize}, XPath=column.4}&quot; Height=&quot;{Binding Converter={StaticResource convertSize}, XPath=column.4}&quot; RenderTransformOrigin=&quot;0.282,0.316&quot; ]
[Ellipse.Fill]
[RadialGradientBrush GradientOrigin=&quot;0.307,0.241&quot;]
[GradientStop Color=&quot;#FFFFFFFF&quot; Offset=&quot;0&quot;/]
[GradientStop Color=&quot;#FF8983AA&quot; Offset=&quot;1&quot;/]
[/RadialGradientBrush]
[/Ellipse.Fill]
[Ellipse.ToolTip]
[StackPanel Width=&quot;250&quot; TextBlock.FontSize=&quot;12&quot;]
[TextBlock FontWeight=&quot;Bold&quot; Text=&quot;{Binding XPath=column.0}&quot; /]
[StackPanel Orientation=&quot;Horizontal&quot;]
[TextBlock Text=&quot;Velocity: &quot; /]
[TextBlock Text=&quot;{Binding XPath=column.2}&quot; /]
[TextBlock Text=&quot; Change: &quot; /]
[TextBlock Text=&quot;{Binding XPath=column.3}&quot; /]
[/StackPanel]
[TextBlock Text=&quot;{Binding XPath=column.5}&quot; TextWrapping=&quot;Wrap&quot;/]
[/StackPanel]
[/Ellipse.ToolTip] 

[/Ellipse]
[/DataTemplate]

And this is my ItemsControl:
[ItemsControl ItemTemplate=&quot;{DynamicResource rowTemplate}&quot; ItemsSource=&quot;{Binding Source={StaticResource DataView}, XPath=/table/row }&quot; Margin=&quot;8,-285,8,0&quot; VerticalAlignment=&quot;Top&quot; Height=&quot;420.952&quot;]
[ItemsControl.ItemsPanel]
[ItemsPanelTemplate]
[Canvas Width=&quot;600&quot; Height=&quot;440&quot; /]
[/ItemsPanelTemplate]
[/ItemsControl.ItemsPanel]

[ItemsControl.ItemContainerStyle]
[Style TargetType=&quot;{x:Type ContentPresenter}&quot; ]
[Setter Property=&quot;Canvas.Left&quot; Value=&quot;{Binding Converter={StaticResource convertOrbit}, XPath=column.2}&quot;/]
[Setter Property=&quot;Canvas.Bottom&quot; Value=&quot;{Binding Converter={StaticResource convertHeight}, XPath=column.3}&quot;/]

[/Style]
[/ItemsControl.ItemContainerStyle]
[/ItemsControl] 

I thought about passing just /table/row in my CollectionViewSource, but it simply passes the whole thing and leaves me with no way to navigate through it. The Select method from XPathNavigator class simply doesn&#039;t work here..

Below is the code I&#039;m using:
private void ShowOnlyTechnologyFilter(object sender, FilterEventArgs e)
{

XmlElement elem = e.Item as XmlElement;
XPathNavigator nav = elem.CreateNavigator();
XPathNodeIterator nodes = nav.Select(&quot;/table/row/column.5&quot;);
if (nodes != null)
{

if (nodes.Current.Value.ToString().Equals(&quot;Technology&quot;))
{
e.Accepted = true;
}
else
{
e.Accepted = false;
}
}
}

private void TechnologyFilter_checked(object sender, RoutedEventArgs e)
{

DataView.Filter += new FilterEventHandler(ShowOnlyTechnologyFilter);
}

private void TechnologyFilter_Unchecked(object sender, RoutedEventArgs e)
{
DataView.Filter -= new FilterEventHandler(ShowOnlyTechnologyFilter);
}

Can you please give me some suggestions on how I should create this filter? 

Thanks,
Susan</description>
		<content:encoded><![CDATA[<p>shao said&#8230;<br />
Hi,<br />
I&#8217;ve been trying to create filters for a scattered plot graph where the data is binding to a xml file. The problem I&#8217;m encountering is that when I create my CollectionViewSource, it looks like this: </p>
<p>[CollectionViewSource x:Key="DataView" Source="{Binding Source={StaticResource tableDS}, XPath=/table/row/column.5}" /]</p>
<p>Since I need column.5 is the one I need to filter out information from to determine whether this node should appear on the graph or not, I am passing the XPath /table/row/column.5, however, I need other columns to construct my ellipses in my graph. For example, the size of each of the ellipse is based on column.4 and its coordinates are based on column.2 and column.3. </p>
<p>This is my DataTemplate:<br />
[DataTemplate x:Key="rowTemplate" ]<br />
[Ellipse Stroke="#FF979798" Width="{Binding Converter={StaticResource convertSize}, XPath=column.4}" Height="{Binding Converter={StaticResource convertSize}, XPath=column.4}" RenderTransformOrigin="0.282,0.316" ]<br />
[Ellipse.Fill]<br />
[RadialGradientBrush GradientOrigin="0.307,0.241"]<br />
[GradientStop Color="#FFFFFFFF" Offset="0"/]<br />
[GradientStop Color="#FF8983AA" Offset="1"/]<br />
[/RadialGradientBrush]<br />
[/Ellipse.Fill]<br />
[Ellipse.ToolTip]<br />
[StackPanel Width="250" TextBlock.FontSize="12"]<br />
[TextBlock FontWeight="Bold" Text="{Binding XPath=column.0}" /]<br />
[StackPanel Orientation="Horizontal"]<br />
[TextBlock Text="Velocity: " /]<br />
[TextBlock Text="{Binding XPath=column.2}" /]<br />
[TextBlock Text=" Change: " /]<br />
[TextBlock Text="{Binding XPath=column.3}" /]<br />
[/StackPanel]<br />
[TextBlock Text="{Binding XPath=column.5}" TextWrapping="Wrap"/]<br />
[/StackPanel]<br />
[/Ellipse.ToolTip] </p>
<p>[/Ellipse]<br />
[/DataTemplate]</p>
<p>And this is my ItemsControl:<br />
[ItemsControl ItemTemplate="{DynamicResource rowTemplate}" ItemsSource="{Binding Source={StaticResource DataView}, XPath=/table/row }" Margin="8,-285,8,0" VerticalAlignment="Top" Height="420.952"]<br />
[ItemsControl.ItemsPanel]<br />
[ItemsPanelTemplate]<br />
[Canvas Width="600" Height="440" /]<br />
[/ItemsPanelTemplate]<br />
[/ItemsControl.ItemsPanel]</p>
<p>[ItemsControl.ItemContainerStyle]<br />
[Style TargetType="{x:Type ContentPresenter}" ]<br />
[Setter Property="Canvas.Left" Value="{Binding Converter={StaticResource convertOrbit}, XPath=column.2}"/]<br />
[Setter Property="Canvas.Bottom" Value="{Binding Converter={StaticResource convertHeight}, XPath=column.3}"/]</p>
<p>[/Style]<br />
[/ItemsControl.ItemContainerStyle]<br />
[/ItemsControl] </p>
<p>I thought about passing just /table/row in my CollectionViewSource, but it simply passes the whole thing and leaves me with no way to navigate through it. The Select method from XPathNavigator class simply doesn&#8217;t work here..</p>
<p>Below is the code I&#8217;m using:<br />
private void ShowOnlyTechnologyFilter(object sender, FilterEventArgs e)<br />
{</p>
<p>XmlElement elem = e.Item as XmlElement;<br />
XPathNavigator nav = elem.CreateNavigator();<br />
XPathNodeIterator nodes = nav.Select(&#8220;/table/row/column.5&#8243;);<br />
if (nodes != null)<br />
{</p>
<p>if (nodes.Current.Value.ToString().Equals(&#8220;Technology&#8221;))<br />
{<br />
e.Accepted = true;<br />
}<br />
else<br />
{<br />
e.Accepted = false;<br />
}<br />
}<br />
}</p>
<p>private void TechnologyFilter_checked(object sender, RoutedEventArgs e)<br />
{</p>
<p>DataView.Filter += new FilterEventHandler(ShowOnlyTechnologyFilter);<br />
}</p>
<p>private void TechnologyFilter_Unchecked(object sender, RoutedEventArgs e)<br />
{<br />
DataView.Filter -= new FilterEventHandler(ShowOnlyTechnologyFilter);<br />
}</p>
<p>Can you please give me some suggestions on how I should create this filter? </p>
<p>Thanks,<br />
Susan</p>
]]></content:encoded>
	</item>
</channel>
</rss>
