(((System.Data.DataView)RadGridView1.ItemsSource).Table.Select("ActivityName like '%" + txtSearch.Text + "%' ")[0]) |
namespace WpfApplication_DataGrid |
{ |
using System; |
using System.Collections.Generic; |
using System.Collections.ObjectModel; |
using System.Windows; |
using System.Windows.Data; |
using Telerik.Windows.Controls; |
/// <summary> |
/// Interaction logic for Window8.xaml |
/// </summary> |
public partial class Window8 : Window |
{ |
public Window8() |
{ |
InitializeComponent(); |
Binding binding; |
ObservableCollection<Receipt> list2 = new ObservableCollection<Receipt>(); |
list2.Add(new Receipt("HELLO", 1123, 456, 1, 8, DateTime.Today, "B")); |
list2.Add(new Receipt("HELLO", 2123, 456, 2, 7, DateTime.Today, "B")); |
list2.Add(new Receipt("HELLO", 3123, 456, 3, 6, DateTime.Today, "C")); |
list2.Add(new Receipt("HELLO", 4123, 456, 4, 5, DateTime.Today, "C")); |
list2.Add(new Receipt("WORLD", 1123, 456, 5, 4, DateTime.Today, "A")); |
list2.Add(new Receipt("WORLD", 2123, 456, 6, 3, DateTime.Today, "B")); |
list2.Add(new Receipt("WORLD", 3123, 456, 7, 2, null, "C")); |
list2.Add(new Receipt("WORLD", 4123, 456, 8, 1, DateTime.Today, "D")); |
list2.Add(new Receipt("WORLD", 4123, 456, 8, 1, DateTime.MinValue, "D")); |
binding = new Binding(); |
binding.Source = list2; |
uxRadGridView.SetBinding(RadGridView.ItemsSourceProperty, binding); |
} |
} |
} |
namespace WpfApplication_DataGrid |
{ |
using System; |
using System.ComponentModel; |
public class Receipt : INotifyPropertyChanged |
{ |
#region fields |
string _source; |
double _amount; |
double _associatedAmount; |
double _allocatedAmount; |
double _availableAmount; |
DateTime? _receiptEffectiveDate; |
string _receiptApplication; |
#endregion |
#region ctor |
public Receipt() |
{ |
} |
public Receipt(string source, double amount, double associatedAmount, double allocatedAmount, double availableAmount, DateTime? receiptEffectiveDate, string receiptApplication) |
{ |
Source = source; |
Amount = amount; |
AssociatedAmount = associatedAmount; |
AllocatedAmount = allocatedAmount; |
AvailableAmount = AvailableAmount; |
ReceiptEffectiveDate = receiptEffectiveDate; |
ReceiptApplication = receiptApplication; |
} |
#endregion |
#region properties |
public string Source |
{ |
get { return _source; } |
set |
{ |
_source = value; |
NotifyPropertyChanged("Source"); |
} |
} |
public double Amount |
{ |
get { return _amount; } |
set |
{ |
_amount = value; |
NotifyPropertyChanged("Amount"); |
} |
} |
public double AssociatedAmount |
{ |
get { return _associatedAmount; } |
set |
{ |
_associatedAmount = value; |
NotifyPropertyChanged("AssociatedAmount"); |
} |
} |
public double AllocatedAmount |
{ |
get { return _allocatedAmount; } |
set |
{ |
_allocatedAmount = value; |
NotifyPropertyChanged("AllocatedAmount"); |
} |
} |
public double AvailableAmount |
{ |
get { return _availableAmount; } |
set |
{ |
_availableAmount = value; |
NotifyPropertyChanged("AvailableAmount"); |
} |
} |
public DateTime? ReceiptEffectiveDate |
{ |
get { return _receiptEffectiveDate; } |
set |
{ |
_receiptEffectiveDate = value; |
NotifyPropertyChanged("ReceiptEffectiveDate"); |
} |
} |
public string ReceiptApplication |
{ |
get { return _receiptApplication; } |
set |
{ |
_receiptApplication = value; |
NotifyPropertyChanged("ReceiptApplication"); |
} |
} |
#endregion |
#region Interface INotifyPropertyChanged |
public event PropertyChangedEventHandler PropertyChanged; |
private void NotifyPropertyChanged(string propertyName) |
{ |
if (PropertyChanged != null) |
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
} |
#endregion |
} |
} |
<Window x:Class="WpfApplication_DataGrid.Window8" Title="Window8" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:local="clr-namespace:WpfApplication_DataGrid" |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
Height="700" Width="900" WindowStartupLocation="CenterScreen"> |
<Window.Resources> |
<LinearGradientBrush x:Key="ColumnHeaderBackgroundBrush" EndPoint="0.494,0.889" StartPoint="0.494,0.028"> |
<GradientStop Color="#FFE7F1FF" Offset="0"/> |
<GradientStop Color="#FFD2E6FF" Offset="0.4"/> |
<GradientStop Color="#FFC7DFFF" Offset="0.4"/> |
<GradientStop Color="#FFC7DFFF" Offset="1"/> |
</LinearGradientBrush> |
<SolidColorBrush x:Key="CellSeperatorBorderBrush" Color="#FFB3B3B3"/> |
<Style x:Key="GridViewHeaderCellStyle" TargetType="{x:Type telerik:GridViewHeaderCell}"> |
<Setter Property="Background" Value="{StaticResource ColumnHeaderBackgroundBrush}" /> |
<Setter Property="BorderBrush" Value="{StaticResource CellSeperatorBorderBrush}"/> |
<Setter Property="BorderThickness" Value="0,0,1,0"/> |
<Setter Property="Foreground" Value="Black"/> |
<Setter Property="FontWeight" Value="Light"/> |
<Setter Property="FontSize" Value="12"/> |
<Setter Property="DropMarkPen"> |
<Setter.Value> |
<Pen Thickness="60"> |
<Pen.Brush> |
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> |
<GradientStop Color="#00F4F5F6" Offset="0"/> |
<GradientStop Color="#B2808080" Offset="0.5"/> |
<GradientStop Color="#00F4F5F6" Offset="1"/> |
</LinearGradientBrush> |
</Pen.Brush> |
</Pen> |
</Setter.Value> |
</Setter> |
<Setter Property="SnapsToDevicePixels" Value="True"/> |
</Style> |
</Window.Resources> |
<Grid> |
<telerik:RadGridView xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
AutoGenerateColumns="False" |
x:Name="uxRadGridView" telerik:StyleManager.Theme="Office_Black"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding Source}" /> |
<telerik:GridViewDataColumn IsFilterable="False" DataMemberBinding="{Binding Amount}" /> |
<telerik:GridViewDataColumn IsFilterable="False" Header="Associated Amount" DataMemberBinding="{Binding AssociatedAmount}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/> |
<telerik:GridViewDataColumn IsFilterable="False" Header="Allocated Amount" DataMemberBinding="{Binding AllocatedAmount}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/> |
<telerik:GridViewDataColumn IsFilterable="False" Header="Available Amount" DataMemberBinding="{Binding AvailableAmount}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/> |
<telerik:GridViewDataColumn IsFilterable="False" Header="Receipt Effective Date" DataMemberBinding="{Binding ReceiptEffectiveDate}" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"/> |
<telerik:GridViewComboBoxColumn IsFilterable="False" UniqueName="ReceiptApplication" Header="Receipt Application" DataMemberBinding="{Binding ReceiptApplication}" /> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
</Grid> |
</Window> |
Hello,
I have a Filter Row in my GridView's header. The normal behaviour of filter is to hide the unmatching rows.
But my requirement is to highlight the matching rows and unmatched rows will still be shown. I am using the following function to do that. I am trying to set the IsSelected Property of the matching records to true, which i hoped will highlight the row. But it is not doing that. Please help.
public void ApplySelect(object sender) |
{ |
try |
{ |
var senderElement = sender as FrameworkElement; |
FilterRowDescriptor newDescriptor = new FilterRowDescriptor(); |
newDescriptor.LogicalOperator = FilterCompositionLogicalOperator.And; |
int idx=0; |
foreach (MainPage.BuyHeadView bhRow in this.grid.Items) |
{ |
TextBox txt = senderElement as TextBox; |
if (bhRow.CampaignName.StartsWith(txt.Text.Trim())) |
{ |
this.grid.Records[idx].IsSelected = true; |
} |
idx++; |
} |
//headerRow.ParentGrid.FilterDescriptors.Remove(headerRow.ParentGrid.FilterDescriptors.Where(fd => fd is FilterRowDescriptor).FirstOrDefault()); |
//headerRow.ParentGrid.FilterDescriptors.Add(newDescriptor); |
} |
catch |
{ |
} |
} |
<UserControl x:Class="MyNamesSpace.Layout.DockingSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
mc:Ignorable="d"
>
<Grid>
<telerikDocking:RadDocking>
<telerikDocking:RadDocking.DocumentHost>
<telerikDocking:RadSplitContainer>
<telerikDocking:RadPaneGroup>
<telerikDocking:RadDocumentPane Header="Document 1" Title="Document 1" />
</telerikDocking:RadPaneGroup>
</telerikDocking:RadSplitContainer>
</telerikDocking:RadDocking.DocumentHost>
<telerikDocking:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft">
<telerikDocking:RadPaneGroup telerikDocking:ProportionalStackPanel.RelativeSize="200, 300">
<telerikDocking:RadPane Header="Pane Left 1" Content="Pane Left 1" />
</telerikDocking:RadPaneGroup>
<telerikDocking:RadPaneGroup telerikDocking:ProportionalStackPanel.RelativeSize="200, 100">
<telerikDocking:RadPane Header="Pane Left 2" Content="Pane Left 2" />
</telerikDocking:RadPaneGroup>
<telerikDocking:RadPaneGroup>
<telerikDocking:RadPane Header="Pane Left 3" Content="Pane Left 3" />
</telerikDocking:RadPaneGroup>
</telerikDocking:RadSplitContainer>
<telerikDocking:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedRight">
<telerikDocking:RadPaneGroup telerikDocking:ProportionalStackPanel.RelativeSize="150, 200">
<telerikDocking:RadPane Header="Pane Right 1" Content="Pane Right 1" />
</telerikDocking:RadPaneGroup>
<telerikDocking:RadPaneGroup telerikDocking:ProportionalStackPanel.RelativeSize="250, 200">
<telerikDocking:RadPane Header="Pane Right 2" Content="Pane Right 2" />
</telerikDocking:RadPaneGroup>
</telerikDocking:RadSplitContainer>
<telerikDocking:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedBottom">
<telerikDocking:RadPaneGroup telerikDocking:ProportionalStackPanel.RelativeSize="100, 200">
<telerikDocking:RadPane Header="Pane Bottom 1" Content="Pane Bottom 1" />
</telerikDocking:RadPaneGroup>
<telerikDocking:RadPaneGroup telerikDocking:ProportionalStackPanel.RelativeSize="300, 200">
<telerikDocking:RadPane Header="Pane Bottom 2" Content="Pane Bottom 2" />
</telerikDocking:RadPaneGroup>
</telerikDocking:RadSplitContainer>
</telerikDocking:RadDocking>
</Grid>
</UserControl>