or
<telerik:GridViewComboBoxColumn Header="Location" DataMemberBinding="{Binding LocationId}" UniqueName="LocationId" ItemsSourceBinding="{Binding Path=Locations,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" SelectedValueMemberPath="Id" DisplayMemberPath="Name" />public class MyViewModel{ public BindingList<Employee> Employees { //The grid binds to this list}}public class Employee{ public string Name{...} public int SelectedLocationId {...} public BindingList<Location> Locations {...} //Binds to combobox in grid.
//Location class has Name and Id property}
private RadDocument CreateHeaderDocument(List<GridViewBoundColumnBase> columns){ RadDocument document = new RadDocument(); Section section = new Section(); Paragraph paragraph = new Paragraph(); paragraph.FontSize = fontSize; PageField pageField = new PageField() { DisplayMode = FieldDisplayMode.Result }; FieldRangeStart pageFieldStart = new FieldRangeStart(); pageFieldStart.Field = pageField; FieldRangeEnd pageFieldEnd = new FieldRangeEnd(); pageFieldEnd.Start = pageFieldStart; paragraph.Inlines.Add(pageFieldStart); paragraph.Inlines.Add(pageFieldEnd); FieldRangeStart numPagesFieldStart = new FieldRangeStart(); numPagesFieldStart.Field = new NumPagesField() { DisplayMode = FieldDisplayMode.Result }; FieldRangeEnd numPagesFieldEnd = new FieldRangeEnd(); numPagesFieldEnd.Start = numPagesFieldStart; var ofSpan = new Span(" of "); ofSpan.FontFamily = fontFamily; ofSpan.FontSize = fontSize; ofSpan.FontWeight = FontWeights.Bold; ofSpan.ForeColor = Color.FromArgb(255, 0, 0, 0); paragraph.Inlines.Add(ofSpan); paragraph.Inlines.Add(numPagesFieldStart); paragraph.Inlines.Add(numPagesFieldEnd); section.Blocks.Add(paragraph); var hdrPara = new Telerik.Windows.Documents.Model.Paragraph(); hdrPara.Background = _headerBackground; var spaceWidth = GetScreenSize("i", fontFamily, fontSize, FontWeights.Bold, FontStyles.Normal, FontStretches.Normal).Width; foreach (GridViewBoundColumnBase col in columns) { String s = String.Empty; if (col.Header != null) { s = col.Header as String; } var span = new Telerik.Windows.Documents.Model.Span(s); span.FontFamily = fontFamily; span.FontSize = fontSize; span.FontWeight = FontWeights.Bold; span.ForeColor = Color.FromArgb(255, 0, 0, 0); var hdrWidth = GetScreenSize(span.Text, span.FontFamily, span.FontSize, span.FontWeight, FontStyles.Normal, FontStretches.Normal).Width; var spaces = (col.ActualWidth - hdrWidth) / spaceWidth; for (int i = 0; i < spaces; i++) { span.Text += " "; } hdrPara.Inlines.Add(span); } section.Blocks.Add(hdrPara); document.Sections.Add(section); return document;}<Window x:Class="GalleryView3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525" MinWidth="350"> <Grid> <Border BorderThickness="3" MinWidth="100" MinHeight="100"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Name="TabGalleryListView" ItemsSource="{Binding Source}" SelectionChanged="SelectionChanged"> <ListView.ItemsPanel> <ItemsPanelTemplate> <telerik:VirtualizingWrapPanel IsItemsHost="True" Orientation="Horizontal" /> <!--<WrapPanel IsItemsHost="True" Orientation="Horizontal" />--> </ItemsPanelTemplate> </ListView.ItemsPanel> <ListView.ItemTemplate> <DataTemplate> <StackPanel Margin="10,10,10,10" Orientation="Vertical"> <Border BorderThickness="3" BorderBrush="Black"> <Image Width="128" Height="128" Source="{Binding ImageSource}" Stretch="Uniform" /> </Border> <StackPanel Orientation="Horizontal" Margin="0,10,0,0" > <CheckBox Margin="0,0,5,0" VerticalAlignment="Center"/> <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Text="{Binding DisplayText}" Foreground="Red"/> </StackPanel> </StackPanel> </DataTemplate> </ListView.ItemTemplate> </ListView> </Border> </Grid> </Window>
Hi,
We had a RadGrid on a form and we are changing cell background of cells manually depending on values in the cells. ANd it works fine but when we scroll down and then back to up then applied colors are meshed up and applied incorrectly
We are using 2011.2.920.40 version of WPF controls.
Thanks