This question is locked. New answers and comments are not allowed.
Hi,
I have been using the 'Stock presentor' cell template from a telerik blog post a while back and it is perfect for my application (I have stopped the animation) but with the latest release of the silverlight controls Im having issues. I upgraded today to the Q1 sp1 (skipping Q1 release) and now when I scroll down the grid (quickly) the cell isnt getting cleared and reloaded for the row it is on so for example i will end up with a red arrow negative number when actually the value for the row is positive
This is the cell template code
and this is my grid code:
Any ideas why this would stop working on this release?
Thanks
I have been using the 'Stock presentor' cell template from a telerik blog post a while back and it is perfect for my application (I have stopped the animation) but with the latest release of the silverlight controls Im having issues. I upgraded today to the Q1 sp1 (skipping Q1 release) and now when I scroll down the grid (quickly) the cell isnt getting cleared and reloaded for the row it is on so for example i will end up with a red arrow negative number when actually the value for the row is positive
This is the cell template code
public partial class StockPricePresenter : UserControl
{
public StockPricePresenter()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(StockPricePresenter_Loaded);
}
void StockPricePresenter_Loaded(object sender, RoutedEventArgs e)
{
this.textBlock.Text = string.Format(
"{0:0}"
, this.Growth);
if (this.Growth <
0
)
{
this.textBlock.Foreground = new SolidColorBrush(Colors.Red);
this.Arrow.Fill = new SolidColorBrush(Colors.Red);
this.ArrowTransform.Angle =
90
;
}
else if (this.Growth >
0
)
{
this.textBlock.Foreground = new SolidColorBrush(Colors.Green);
this.Arrow.Fill = new SolidColorBrush(Colors.Green);
this.ArrowTransform.Angle =
-90
;
}
else
{
this.textBlock.Foreground = new SolidColorBrush(Colors.Gray);
this.Arrow.Fill = new SolidColorBrush(Colors.Gray);
this.ArrowTransform.Angle =
0
;
}
}
public
decimal
Growth
{
get { return (
decimal
)GetValue(GrowthProperty); }
set { SetValue(GrowthProperty, value); }
}
// Using a DependencyProperty as the backing store for StockPrice. This enables animation, styling, binding, etc...
public
static
readonly DependencyProperty GrowthProperty =
DependencyProperty.Register(
"Growth"
, typeof(
decimal
), typeof(StockPricePresenter), new PropertyMetadata(null));
}
and this is my grid code:
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.Resources
>
<
DataTemplate
x:Key
=
"SalesGrowth"
>
<
my:StockPricePresenter
Growth
=
"{Binding Growth}"
/>
</
DataTemplate
>
<
local:ImageCovertor
x:Key
=
"ImageConverter"
/>
<
local:ImageCovertorToolTip
x:Key
=
"ImageConvertertTip"
/>
<
my:DateConvertor
x:Key
=
"DateConvert"
></
my:DateConvertor
>
</
Grid.Resources
>
<
telerik:RadGridView
x:Name
=
"Search"
Grid.Column
=
"0"
EnableRowVirtualization
=
"True"
IsReadOnly
=
"True"
AutoExpandGroups
=
"True"
Visibility
=
"Visible"
ItemsSource
=
"{Binding}"
AutoGenerateColumns
=
"False"
my:GridViewHeaderMenu.IsEnabled
=
"True"
ShowGroupFooters
=
"True"
ShowColumnFooters
=
"True"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Territory"
UniqueName
=
"Territory"
DataMemberBinding
=
"{Binding Territory}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Aligned Person"
UniqueName
=
"Person"
DataMemberBinding
=
"{Binding AlignedPerson}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Product"
UniqueName
=
"Product"
DataMemberBinding
=
"{Binding ProductLine}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Code}"
UniqueName
=
"Code"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:CountFunction
Caption
=
"Customers: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
MinWidth
=
"60"
Width
=
"*"
Header
=
"Name"
UniqueName
=
"Name"
DataMemberBinding
=
"{Binding Name}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
MinWidth
=
"60"
Width
=
"*"
Header
=
"Street"
UniqueName
=
"Street"
DataMemberBinding
=
"{Binding Street}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
MinWidth
=
"60"
Width
=
"*"
Header
=
"City"
UniqueName
=
"City"
DataMemberBinding
=
"{Binding City}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Rank"
DataMemberBinding
=
"{Binding Rank}"
UniqueName
=
"Rank"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Quintile"
DataMemberBinding
=
"{Binding Quintile}"
UniqueName
=
"Quinti"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Last Inv Date"
DataMemberBinding
=
"{Binding LastInvoiceDate, Converter={StaticResource DateConvert}}"
UniqueName
=
"d"
DataFormatString
=
"{}{0:dd/MM/yyyy}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Last Inv Units"
DataMemberBinding
=
"{Binding LastInvoiceQuantity}"
UniqueName
=
"Lastinv"
IsVisible
=
"False"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewImageColumn
Header
=
""
DataMemberBinding
=
"{Binding LastInvoiceDate, Converter={StaticResource ImageConverter}}"
>
<
telerik:GridViewImageColumn.ToolTipTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding LastInvoiceDate, Converter={StaticResource ImageConvertertTip}}"
/>
</
DataTemplate
>
</
telerik:GridViewImageColumn.ToolTipTemplate
>
</
telerik:GridViewImageColumn
>
<
telerik:GridViewDataColumn
Header
=
"YTD Sales"
UniqueName
=
"Sales"
DataMemberBinding
=
"{Binding YTDSales}"
DataFormatString
=
"{}{0:0.0}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
Caption
=
"Total: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"YTD Counting Units"
UniqueName
=
"Cunits"
DataMemberBinding
=
"{Binding NetUnitsCount}"
DataFormatString
=
"{}{0:0}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
Caption
=
"Total Units: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Growth %"
DataMemberBinding
=
"{Binding GrowthPCT}"
UniqueName
=
"growthpct"
DataFormatString
=
"{}{0:0.0%}"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
MinWidth
=
"120"
Header
=
"Growth"
DataMemberBinding
=
"{Binding Growth}"
UniqueName
=
"growthind"
DataFormatString
=
"{}{0:0.0}"
Width
=
"*"
CellTemplate
=
"{StaticResource SalesGrowth}"
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
telerik:SumFunction
Caption
=
"Total Growth: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Commercial Territory"
DataMemberBinding
=
"{Binding hasCommercialTerritory}"
UniqueName
=
"commercialTerritory"
Width
=
"60"
></
telerik:GridViewDataColumn
>
<
telerik:GridViewColumn
Header
=
"View"
Width
=
"60"
UniqueName
=
"Selector"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
x:Name
=
"dtTemp1"
>
<
Button
x:Name
=
"btnSelect"
Height
=
"20"
Width
=
"40"
BorderThickness
=
"0"
Click
=
"btnSelect_Click"
>
<
TextBlock
Text
=
"View"
></
TextBlock
>
</
Button
>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
Any ideas why this would stop working on this release?
Thanks