<DataTemplate x:Name="DatePickerCellTemplate" x:Key="DatePickerCellTemplate"> |
<telerik:RadDatePicker SelectedDate="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewCell}},Path=Value, Mode=TwoWay}" /> |
</DataTemplate> |
<
telerikControls:RadGridView Name="MyGrid" CanUserFreezeColumns="False" ....
with a column like this:
<
telerikControls:GridViewDataColumn Header="MyColumn" IsFilterable="False"
DataMemberBinding="{Binding MyProperty}">
<telerikControls:GridViewDataColumn.AggregateFunctions>
<telerikData:CountFunction Caption="Count: " />
</telerikControls:GridViewDataColumn.AggregateFunctions>
</telerikControls:GridViewDataColumn> ...
and somewhere in the UI, a textblock like this:
<
TextBlock Name="MyTextBlock" Text="{Binding ElementName=MyGrid, Path=???CountResultFromFooter???}" />
How can I bind to MyTextBlock the result of the count aggregate function from MyColumn column?
I am using Telerik RadGridView in my project. I want to show image in column.
GridViewImageColumn col1 = new GridViewImageColumn(); |
col1.Width = 100; |
col1.DataMemberBinding = new Binding("id"); |
col1.Header = "PhotoByConverter"; |
col1.DataMemberBinding.Converter = new ThumbnailConverter(); |
grid.Columns.Add(col1); |
GridViewDataColumn col2 = new GridViewDataColumn(); |
col2.Width = 100; |
col2.DataMemberBinding = new Binding("firstName"); |
col2.Header = "Person name"; |
grid.Columns.Add(col2); |
Grid.ItemsSource=DataTable; |
public class ThumbnailConverter : IValueConverter |
{ |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
{ |
IEnumerable<thumbNail> result = from n in thumbnails |
where n.personID == value.ToString() |
select n; |
if (result != null && result.First().thumbnail != null) |
{ |
return result.First().thumbnail.file; |
} |
else |
{ |
return null; |
} |
} |
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
{ |
throw new Exception("The method or operation is not implemented."); |
} |
} |
I found by id thumbnail of person and set it like data for GridViewImageColumn. I checked with Debuger conveter works properly. I can't undesrtand why it doesn't work. Any ideas?
I use 2009 Q3 version.
My converter returns byte[] type
namespace WpfApplication7 |
{ |
public class MyGrid : RadGridView |
{ |
public override void OnApplyTemplate() |
{ |
//Custom Code. |
} |
} |
} |
<Window x:Class="WpfApplication7.Window1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:gridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
xmlns:local="clr-namespace:WpfApplication7" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Title="Window1" Height="300" Width="300"> |
<Grid> |
<local:MyGrid> |
<gridView:RadGridView.Columns> |
<gridView:GridViewColumn Header="Column1"/> |
<gridView:GridViewColumn Header="Column2"/> |
<gridView:GridViewColumn Header="Column3"/> |
<gridView:GridViewColumn Header="Column4"/> |
</gridView:RadGridView.Columns> |
</local:MyGrid> |
</Grid> |
</Window> |
public void Add(TEntityType item) |
{ |
if (Criteria(item)) |
{ |
InnerList.Add(item); |
CollectionChanged(InnerList, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item)); |
if (SelectAddedItem) CurrentItem = item; |
} |
} |