A question with silverlight

Apr 20, 2009 at 5:40 PM
Edited Apr 20, 2009 at 9:46 PM
On the page: http://www.mscui.net/Blog/2009/04/default.aspx

The Redesigning the Graphing Control page

On "How to position the X-axis at the bottom the graph"

I can't understand what does them mean about "1.Get the existing control template and generate a local copy of the template (as above)." and "7.Add the property PlotTicksBeforeLabels="True" to the TimeLineGraph."

How could I do to this two things?


Developer
Apr 21, 2009 at 10:39 AM

Hello

If you've been following the blog from the top, you will have already performed "1.Get the existing control template and generate a local copy of the template (as above)." when you followed these three steps:

"5. Right click on the graph, select Edit Control Parts (Template).
6. Select Edit a copy.
7. Click OK when prompted."

For step "7.Add the property PlotTicksBeforeLabels="True" to the TimeLineGraph", you should find the TimeLineGraph control is declared in the XAML at line 205.

This is what the line should look like after the property has been added, note your Margin may have different values:

<Microsoft_Cui_Controls:TimeLineGraph Margin="8,8,8,8" Style="{StaticResource TimeLineGraphStyle1}" PlotTicksBeforeLabels="True"/>

Please also repeat step "5. Replace the contents of ELEMENT_dynamicMainLayerTemplate with the following:" as we've recently made a change to the XAML.

Regards
Ben

Apr 21, 2009 at 10:52 AM

Yes, I have see <Microsoft_Cui_Controls:TimeLineGraph Margin="8,8,8,8" Style="{StaticResource TimeLineGraphStyle1}" /> at line 204

After I add PlotTicksBeforeLabels="True"

I can't see the X-axis at the bottom the graph

What's wrong with me?

Developer
Apr 21, 2009 at 11:38 AM
Hello

Did you do as I suggested and repeat step 5 to replace the XAML for ELEMENT_dynamicMainLayerTemplate a second time following our update to the blog?

If you've already done that please share your XAML so I can take a look for you.

Regards
Ben
Apr 21, 2009 at 12:40 PM

Thank you for your help.

This is my code:

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SilverlightApplication2.Page"
Width="640" Height="480" xmlns:Microsoft_Cui_Controls="clr-namespace:Microsoft.Cui.Controls;assembly=Microsoft.Cui.Controls">

<UserControl.Resources>
<ControlTemplate x:Key="ToolTipTemplate" TargetType="ToolTip">
<Border Background="#FFFFFBE9" BorderBrush="#FF080808" BorderThickness="1,1,1,1" CornerRadius="2">
<Grid>
<ContentPresenter HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" VerticalAlignment="Top" Grid.Column="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
</Grid>
</Border>
</ControlTemplate>
<Style x:Key="ELEMENT_directionArrowStyle" TargetType="Button">
<Setter Property="Canvas.ZIndex" Value="1000"/>
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="IsHitTestVisible" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<ToolTipService.ToolTip>
<ToolTip Template="{StaticResource ToolTipTemplate}">
<TextBlock HorizontalAlignment="Left" FontWeight="Normal" Text="Scroll to view more data" TextWrapping="Wrap"/>
</ToolTip>
</ToolTipService.ToolTip>
<Rectangle Fill="Transparent"/>
<Polygon Opacity="0.5" Fill="#BB0000" Stroke="#000000" StrokeThickness="1" Points="8,0, 16,6, 12,6, 12,12, 4,12, 4,6, 0,6"/>
<ContentPresenter HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TimeLineGraphStyle1" TargetType="Microsoft_Cui_Controls:TimeLineGraph" >
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="Microsoft_Cui_Controls:TimeLineGraph" >
<Grid >
<Border BorderBrush="Gray" BorderThickness="1" CornerRadius="4" >
<Grid x:Name="ELEMENT_layoutRoot" Background="{TemplateBinding Background}" >
<Grid.Resources>
<DataTemplate x:Key="ELEMENT_dynamicMainLayerTemplate">
<Grid x:Name="ELEMENT_dynamicMainLayer">
<Grid.RowDefinitions> 
<RowDefinition Height="*"/> 
<RowDefinition Height="30"/> 
</Grid.RowDefinitions> 

<Canvas Grid.Row="0" x:Name="ELEMENT_dynamicPlotLayerViewport" Canvas.ZIndex="5" > 
<Canvas x:Name="ELEMENT_dynamicPlotLayer"/> 
</Canvas> 

<Canvas Grid.Row="1" x:Name="ELEMENT_dynamicTopAxisLayerViewport" VerticalAlignment="Top" Canvas.ZIndex="10" Margin="0,5,0,0"> 
<Canvas x:Name="ELEMENT_dynamicTopAxisLayer"/> 
</Canvas>
</Grid>
</DataTemplate>
<DataTemplate x:Key="ELEMENT_collisionTemplate">
<Grid Height="19" Width="23" Opacity="0.6" Canvas.ZIndex="6" Microsoft_Cui_Controls:GraphBase.XOffset="0" Microsoft_Cui_Controls:GraphBase.YOffset="-23">
<ToolTipService.ToolTip>
<ToolTip Template="{StaticResource ToolTipTemplate}">
<StackPanel Margin="5,0,5,0" Width="125">
<TextBlock HorizontalAlignment="Left" FontWeight="Bold" Text="Overcrowded data" TextWrapping="Wrap"/>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap"><Run Text="Adjust your timescale to see this data."/></TextBlock>
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
<Path Margin="0.4,0.4,0.2,0.2" Fill="#FFF3F500" Stretch="Fill" Stroke="#FF000000" StrokeEndLineCap="Round" StrokeLineJoin="Round" StrokeStartLineCap="Round" StrokeThickness="1.2" Data="M0.75,14.125 C17.375,14.125 17.125,14.125 17.125,14.125 L9.1251093,0.125 z"/>
<Path Margin="10.25,6.125,9.75,2.75" RenderTransformOrigin="0,0" Fill="#FF000000" Stretch="Fill" Data="M1.9921874,9.7406769 C2.2382813,9.7406769 2.4482422,9.8256378 2.6220703,9.9955597 C2.7958984,10.165482 2.8828125,10.371536 2.8828125,10.613724 C2.8828125,10.887161 2.7949219,11.102005 2.6191406,11.258255 C2.4433594,11.414505 2.2382813,11.49263 2.0039063,11.49263 C1.765625,11.49263 1.5576172,11.415482 1.3798828,11.261185 C1.2910156,11.184036 1.2243652,11.091507 1.1799316,10.983597 C1.135498,10.875687 1.1132813,10.752396 1.1132813,10.613724 C1.1132813,10.371536 1.1982422,10.165482 1.3681641,9.9955597 C1.5380859,9.8256378 1.7460938,9.7406769 1.9921874,9.7406769 z M2.0390625,2.6215363 C2.2070313,2.6215363 2.347168,2.650589 2.4594727,2.7086945 C2.5717773,2.7667999 2.65625,2.8539581 2.7128906,2.9701691 C2.7695313,3.08638 2.8120117,3.2282257 2.840332,3.3957062 C2.8686523,3.5631866 2.8828125,3.7563019 2.8828125,3.9750519 C2.8828125,4.2328644 2.8691406,4.4945831 2.8417969,4.7602081 L2.5898438,7.64888 C2.5625,7.99263 2.5039063,8.2563019 2.4140625,8.4398956 C2.3691406,8.5316925 2.3095703,8.6005402 2.2353516,8.6464386 C2.1611328,8.692337 2.0722656,8.7152863 1.96875,8.7152863 C1.8632813,8.7152863 1.7739258,8.6930695 1.7006836,8.6486359 C1.6274414,8.6042023 1.5703125,8.5375519 1.5292969,8.4486847 C1.4882813,8.3598175 1.453125,8.247757 1.4238281,8.1125031 C1.3945313,7.9772491 1.3710938,7.8188019 1.3535156,7.6371613 L1.1660156,4.8305206 C1.1484375,4.5570831 1.1352539,4.3222198 1.1264648,4.1259308 C1.1176758,3.9296417 1.1132813,3.7719269 1.1132813,3.6527863 C1.1132813,3.3285675 1.1982422,3.0756378 1.3681641,2.8939972 C1.453125,2.8031769 1.5515137,2.7350616 1.6633301,2.6896515 C1.7751465,2.6442413 1.9003906,2.6215363 2.0390625,2.6215363 z">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</DataTemplate>
<DataTemplate x:Key="ELEMENT_dataMarkerTemplate">
<Rectangle Height="5" Width="5" Canvas.ZIndex="10" Fill="Blue" Stroke="Black" StrokeThickness="3" Microsoft_Cui_Controls:GraphBase.XOffset="-2.5" Microsoft_Cui_Controls:GraphBase.YOffset="-2.5"/>
</DataTemplate>
<DataTemplate x:Key="ELEMENT_PointTemplate">
<Microsoft_Cui_Controls:GraphPoint Canvas.ZIndex="9999" Y1="{Binding Path=Y1}"/>
</DataTemplate>
<DataTemplate x:Key="ELEMENT_LabelTemplate" >
<Border RenderTransformOrigin="0, 1" Canvas.ZIndex="9999" Microsoft_Cui_Controls:GraphBase.XOffset="2" Microsoft_Cui_Controls:GraphBase.YOffset="-15" Background="White" BorderBrush="DarkGray" BorderThickness="1" CornerRadius="2" Padding="0">
<StackPanel Margin="0,-1,0,-1">
<TextBlock HorizontalAlignment="Left" Margin="0,0,0,0" x:Name="ELEMENT_labelTextBlock" Text="{Binding Path=DataContext}"/>
</StackPanel>
</Border>
</DataTemplate>
<ScaleTransform x:Key="ELEMENT_LabelTransform" ScaleX="1.4" ScaleY="1.4"/>
<DataTemplate x:Key="ELEMENT_XAxisLabelTemplate">
<TextBlock FontSize="11"/>
</DataTemplate>
<DataTemplate x:Key="ELEMENT_YAxisLabelTemplate">
<TextBlock FontSize="11"/>
</DataTemplate>
<Microsoft_Cui_Controls:TimeFrequency x:Key="DefaultVisibleWindow" Unit="Minute" Value="5"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Grid x:Name="ELEMENT_TitleArea" Grid.ColumnSpan="2" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<Rectangle Grid.ColumnSpan="3" RadiusX="2" RadiusY="2"/>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal">
<TextBlock Margin="5,0,0,0" FontSize="12" FontWeight="Bold" Text="{Binding Path=Title}"/>
<TextBlock Margin="5,0,0,0" FontSize="12" FontStyle="Italic" Text="{Binding Path=Units}" ToolTipService.ToolTip="{Binding Path=UnitsDescription}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Visibility="{Binding Path=ShowNormalRange}" Grid.Column="1" Orientation="Horizontal">
<TextBlock Margin="5,0,0,0" FontSize="12" Text="Adult normal range"/>
<TextBlock Margin="5,0,0,0" FontSize="12" FontStyle="Italic" Text="{Binding Path=NormalRangeMinimumValue}"/>
<TextBlock Margin="5,0,0,0" FontSize="12" FontStyle="Italic" Text="-"/>
<TextBlock Margin="5,0,0,0" FontSize="12" FontStyle="Italic" Text="{Binding Path=NormalRangeMaximumValue}"/>
<TextBlock Margin="5,0,0,0" FontSize="12" FontStyle="Italic" Text="{Binding Path=Units}" ToolTipService.ToolTip="{Binding Path=UnitsDescription}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right" Margin="0,2,1,2" VerticalAlignment="Center" Grid.Column="2" Orientation="Horizontal">
<Microsoft_Cui_Controls:CuiToggleButton HorizontalAlignment="Stretch" Margin="5,0,0,0" x:Name="ELEMENT_ScaleToFit" VerticalAlignment="Stretch" Width="50" IsTabStop="False">
<Microsoft_Cui_Controls:CuiToggleButton.PressedStateContent>
<Grid Height="20" Width="50" Background="Orange" ToolTipService.ToolTip="Return to default scale">
<Polyline Stroke="Black" Points="25,7 25,0 28,3"/>
<Polyline Stroke="Black" Points="25,0 22,3"/>
<Polyline Stroke="Blue" Points="2,12 12,2 35,10 45,3"/>
<Polyline Stroke="Black" Points="25,8 25,14 28,11"/>
<Polyline Stroke="Black" Points="25,14 22,11"/>
</Grid>
</Microsoft_Cui_Controls:CuiToggleButton.PressedStateContent>
<Grid Height="20" Width="50" Background="Transparent" ToolTipService.ToolTip="Scale to fit all data">
<Polyline Stroke="Black" Points="25,0 25,5 28,3"/>
<Polyline Stroke="Black" Points="25,5 22,3"/>
<Polyline Stroke="Blue" Points="2,12 12,2 35,10 45,3"/>
<Polyline Stroke="Black" Points="25,18 25,10 28,12"/>
<Polyline Stroke="Black" Points="25,10 22,12"/>
</Grid>
</Microsoft_Cui_Controls:CuiToggleButton>
<Microsoft_Cui_Controls:CuiToggleButton HorizontalAlignment="Stretch" x:Name="ELEMENT_MinimizeToTitle" VerticalAlignment="Stretch" Width="20" IsTabStop="False">
<Microsoft_Cui_Controls:CuiToggleButton.PressedStateContent>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" ToolTipService.ToolTip="Maximize">
<Rectangle Height="10" Width="10" Stroke="#FF000000" StrokeThickness="2"/>
</Grid>
</Microsoft_Cui_Controls:CuiToggleButton.PressedStateContent>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" ToolTipService.ToolTip="Minimize">
<Rectangle Height="1" Margin="0,8,0,0" Width="10" Stroke="#FF000000" StrokeThickness="2"/>
</Grid>
</Microsoft_Cui_Controls:CuiToggleButton>
</StackPanel>
</Grid>
<Grid Margin="5,0,30,0" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="Gray" BorderThickness="1,0,1,1">
<TextBlock x:Name="ELEMENT_XAxisTitleStartDate" FontSize="14" Text=""/>
</Border>
<Border Grid.Column="2" BorderBrush="Gray" BorderThickness="1,0,1,1">
<TextBlock HorizontalAlignment="Right" x:Name="ELEMENT_XAxisTitleEndDate" FontSize="14" Text=""/>
</Border>
</Grid>
<Canvas Margin="5,0,30,5" x:Name="ELEMENT_dynamicMainLayerViewport" Grid.Row="2" Canvas.ZIndex="10" Background="White">
<Button Margin="0,30,0,0" x:Name="ELEMENT_directionArrowUp" Style="{StaticResource ELEMENT_directionArrowStyle}"/>
<Button Margin="0,0,0,5" x:Name="ELEMENT_directionArrowDown" Style="{StaticResource ELEMENT_directionArrowStyle}">
<Button.RenderTransform>
<RotateTransform Angle="180"/>
</Button.RenderTransform>
</Button>
</Canvas>
<Canvas Margin="5,0,0,30" x:Name="ELEMENT_nonDynamicRightAxisViewPort" Grid.Row="2" Background="#BFC8F2" Canvas.ZIndex="5">
<Canvas x:Name="ELEMENT_NonDynamicRightAxisLabels"/>
<Canvas x:Name="ELEMENT_NonDynamicRightAxisLines"/>
</Canvas>
<ScrollBar Margin="2,0,2,30" x:Name="ELEMENT_scrollBarVertical" Grid.Column="1" Grid.Row="2" Orientation="Vertical" LargeChange="10" Maximum="155" Minimum="-155" SmallChange="5" Value="0"/>
<ScrollBar Margin="2,2,2,2" x:Name="ELEMENT_scrollBar" Grid.Row="3" Orientation="Horizontal"/>
</Grid>
</Border>
<Rectangle Margin="1, 1, 1, 1" x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" Stroke="Black" StrokeDashArray="3 4" StrokeThickness="1"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>

<Grid x:Name="LayoutRoot" Background="White" >
<Microsoft_Cui_Controls:TimeLineGraph Margin="8,8,8,25" Style="{StaticResource TimeLineGraphStyle1}" PlotTicksBeforeLabels="True"/>
</Grid>
</UserControl>

Developer
Apr 21, 2009 at 1:01 PM
Hello

It looks like you still have the old version of the XAML for ELEMENT_dynamicMainLayerTemplate from step 5 which has been updated.

This section:

<DataTemplate x:Key="ELEMENT_dynamicMainLayerTemplate">
<Grid x:Name="ELEMENT_dynamicMainLayer">
<Grid.RowDefinitions> 
<RowDefinition Height="*"/> 
<RowDefinition Height="30"/> 
</Grid.RowDefinitions> 

<Canvas Grid.Row="0" x:Name="ELEMENT_dynamicPlotLayerViewport" Canvas.ZIndex="5" > 
<Canvas x:Name="ELEMENT_dynamicPlotLayer"/> 
</Canvas> 

<Canvas Grid.Row="1" x:Name="ELEMENT_dynamicTopAxisLayerViewport" VerticalAlignment="Top" Canvas.ZIndex="10" Margin="0,5,0,0"> 
<Canvas x:Name="ELEMENT_dynamicTopAxisLayer"/> 
</Canvas>
</Grid>
</DataTemplate>

Should be as follows, the element for "<Canvas Grid.Row="1"" appearing before the element for "<Canvas Grid.Row="0"":

<DataTemplate x:Key="ELEMENT_dynamicMainLayerTemplate">
<Grid x:Name="ELEMENT_dynamicMainLayer">
<Grid.RowDefinitions> 
<RowDefinition Height="*"/> 
<RowDefinition Height="30"/> 
</Grid.RowDefinitions> 

<Canvas Grid.Row="1" x:Name="ELEMENT_dynamicTopAxisLayerViewport" VerticalAlignment="Top" Canvas.ZIndex="10" Margin="0,5,0,0"> 
<Canvas x:Name="ELEMENT_dynamicTopAxisLayer"/> 
</Canvas>

<Canvas Grid.Row="0" x:Name="ELEMENT_dynamicPlotLayerViewport" Canvas.ZIndex="5" > 
<Canvas x:Name="ELEMENT_dynamicPlotLayer"/> 
</Canvas> 
</Grid>
</DataTemplate>

Hope this helps.

Regards
Ben
Apr 21, 2009 at 1:08 PM
I can see the X-axis at the bottom the graph now,thanks.
Apr 29, 2009 at 8:35 AM

I try Extending Graph Behavior

But  I have a question:

Should I  type "public class DataView" and "public class TimeGraphExtender" two codes into Window1.xaml.cs?

But after I type them, it says that "Couldn't find DataGrid."

What's wrong with me?

Developer
Apr 29, 2009 at 11:48 AM
Hello

If you are getting an error regarding DataGrid you probably haven't completed the step highlighted in yellow which is a bit further down:


Note: DataGrid resides in System.Windows.Controls.Data.dll. We need to add a reference to the DLL and define an xmlns with a namespace prefix of "extended"
xmlns:extended="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"


You shouldn't have to type anything into Window1.xaml.cs.

This filename also suggests you've created a WPF application instead of a Silverlight one which would normally contain "Page.xaml.cs".

If this is the case, please be aware that although you can still implement the new feature in WPF there are small differences between Silverlight and WPF and the steps in the blog are written for Silverlight. You may have to debug any problems relating to WPF.

Regards
Ben
Apr 29, 2009 at 4:56 PM
Edited Apr 30, 2009 at 6:05 PM

Thank  you for your response.

I have a question that I am Confused in the yellow note and I can't find the reference: System.Windows.Controls.Data.dll

Where I can find it?

Developer
May 5, 2009 at 1:43 PM
Hello

That assembly can be found in:

C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client

Regards
Ben
May 5, 2009 at 8:10 PM
I see a problem in the blog: Redesigning the Graphing Control
On "How to position the X-axis at the bottom the graph:" this side, at step 5, if I type 
<Grid x:Name="ELEMENT_dynamicMainLayer"> 
<Grid.RowDefinitions> 
<RowDefinition Height="*"/> 
<RowDefinition Height="30"/> 
</Grid.RowDefinitions> 

<Canvas Grid.Row="1" x:Name="ELEMENT_dynamicTopAxisLayerViewport" VerticalAlignment="Top" Canvas.ZIndex="10" Margin="0,5,0,0"> 
<Canvas x:Name="ELEMENT_dynamicTopAxisLayer"/> 
</Canvas> 

<Canvas Grid.Row="0" x:Name="ELEMENT_dynamicPlotLayerViewport" Canvas.ZIndex="5"> 
<Canvas x:Name="ELEMENT_dynamicPlotLayer"/> 
</Canvas> 

</Grid>

There are a problem to show the graph, but when I type:

<Grid x:Name="ELEMENT_dynamicMainLayer">
<Grid.RowDefinitions> 
<RowDefinition Height="*"/> 
<RowDefinition Height="30"/> 
</Grid.RowDefinitions> 

<Canvas Grid.Row="0" x:Name="ELEMENT_dynamicPlotLayerViewport" Canvas.ZIndex="5"> 
<Canvas x:Name="ELEMENT_dynamicPlotLayer"/> 
</Canvas>

  <Canvas Grid.Row="1" x:Name="ELEMENT_dynamicTopAxisLayerViewport" VerticalAlignment="Top" Canvas.ZIndex="10" Margin="0,5,0,0"> 
<Canvas x:Name="ELEMENT_dynamicTopAxisLayer"/> 
</Canvas> 

</Grid>

That's will be fine.

Developer
May 6, 2009 at 10:43 AM
Hello

That is what we discussed a few posts above dated "Apr 21 at 1:01 PM".

As I said there, the element for "<Canvas Grid.Row="1"" must appear before the element for "<Canvas Grid.Row="0"". That is how it appears in the blog.

Your second piece of XAML has Row 0 before Row 1 and was cause of the problem in your post dated "Apr 21 at 12:40 PM".

Regards
Ben
May 10, 2009 at 11:31 AM

Thank you a lot.

Now, I'm just on the step: Modify the TimeGraphExtender class and add the following code.

But after I typed the TimeGraphExtender, VS 2008 show an error: Can't find IEnumerable

What's wrong?

Developer
May 11, 2009 at 9:48 AM

Hello

IEnumerable is part of the System.Collections namespace, you'll need to add the following using directive at the top of the TimeGraphExtender class:

 

using System.Collections;

 

Regards

Ben

May 11, 2009 at 5:15 PM

Thank you, I have solved the problem.

But, in xaml file, there are 3 errors:

1."TimeGraphExtender" doesn't exist in the "ckr-namespace:ExtendingGraphBehavior".

2."DataView" doesn't exist in the "ckr-namespace:ExtendingGraphBehavior".

3." The property "Key" is only used in "IDictionary".

The error were happened befor the step "Switch to the design view in Blend and you can see a button "T" at the top right corner of the graph:".

Developer
May 12, 2009 at 9:24 AM

Hello

What is the namespace in those two classes? If you have been following the steps in the blog it will be "ExtendingGraphBehavior".

 

This namespace is referenced in the XAML at the step which asked you to:

 

"Define an xmlns with a namespace prefix of "local"

xmlns:local="clr-namespace:ExtendingGraphBehavior""


If you are using a different namespace, the first two errors will be because the reference to "local:TimeGraphExtender" cannot be resolved and you'll need to adjust the code samples to correspond with the names in your project

 

I have not seen the third problem before, please double check what you have done for other errors.

 

Regards

Ben

May 12, 2009 at 4:42 PM

Thank you.

I really type the wrong namespace.

But the 3rd error still happened, and there was a error showed on the page when I compiler:

Detailed information on error pages

User-agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Timestamp: Tue, 12 May 2009 15:36:38 UTC


message: Unhandled Error in Silverlight 2 Application Grid doesn't support the content of DataView。 [Line: 236 Position: 25]
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at SilverlightApplication1.Page.InitializeComponent()
   at SilverlightApplication1.Page..ctor()
   at SilverlightApplication1.App.OnStartup(Object sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

URI: http://localhost:51182/Default.html

 

Developer
May 14, 2009 at 1:55 PM

Hello

 

That error doesn't suggest any obvious problem, you need to debug your code.

 

If you're still stuck, I suggest you start again with a clean project.

 

Regards

Ben

May 14, 2009 at 5:02 PM
Edited May 19, 2009 at 3:00 AM

Thank you.

I can see a button "T" at the top right corner of the graph.

But, I don't understand the next step:Give some data to the graph and run the solution.

Where I should type in the data? In xaml file?  In xaml.cs file? Or  in TimeGraphExtender.cs?

And, I have a question between Silverlight and WPF:

On the yellow step:

Note: DataGrid resides in System.Windows.Controls.Data.dll. We need to add a reference to the DLL and define an xmlns with a namespace prefix of "extended"

In Silverlight, I have to add System.Windows.Controls.Data.dll to the reference, but in WPF, which dll should I add to the reference?

 

Developer
May 22, 2009 at 2:30 PM

Hello

Additional information about binding data to a graph is provided on the Graphing Control page at http://mscui.net/Components/Graphing.aspx. You need to expand the panel at the bottom "Usage Hints - Data Binding".

Another option is to copy the sample data provided with our source code from GraphingSamplePage.xaml.

 

The WPF DataGrid can be found in the WPF Toolkit http://www.codeplex.com/wpf

Regards

Ben