<
books
Name
=
"a"
>
<
book
Name
=
""
Index
=
"1"
Media
=
"1.mp3"
>
</
book
>
<
book
Name
=
"b"
Index
=
"2"
Media
=
"2.mp3"
>
</
book
>
</
books
>
<
text
>
<
mainText
>
text1
</
mainText
>
<
mainText
>
text2
</
mainText
>
</
text
>
IsFilteringAllowed="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.IsAdvancedUserInterfaceOn}"
I using radGridView containing two columns, one is of a plain text type and the other one is of a Rich Text (RadRichTextBox).
In order to implement it, I’ve set the grid column’s CellTemplate property (as shown in the following code).
Inside the cell, the data is being shown correctly. But the cell is being drawn with large margins (which become more noticeable when the row is selected or is the current row).
(Screenshot - http://imageshack.us/photo/my-images/864/radgriditemcontainersty.gif/ )
When clicking on those margins the cell’s content disappears.
What do I need to do in order to eliminate the cell margin?
Code:
<Window x:Class="GridTesting.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"
xmlns:telerikProvider="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"
Title="MainWindow" Height="350" Width="780" x:Name="GridTesting"
>
<Grid>
<telerik:RadGridView
CanUserReorderColumns="True" ReorderColumnsMode="ReorderColumns"
RowIndicatorVisibility="Visible" SelectionMode="Extended" ShowGroupPanel="False"
CanUserInsertRows="True" ShowInsertRow="False" CanUserDeleteRows="True" DragElementAction="None"
ItemsSource="{Binding ItemsSource, ElementName=GridTesting}" AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Name" Width="2*" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBox Text="{Binding Name, Mode=TwoWay}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="Wrap"
BorderThickness="0" Padding="0" Margin="0" MaxHeight="100"/>
</StackPanel>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Description" Width="5*">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<telerik:RadRichTextBox x:Name="DescriptionRichTextBox" AcceptsTab="False" MaxHeight="100" BorderThickness="0" IsSpellCheckingEnabled="False" />
<telerikProvider:HtmlDataProvider RichTextBox="{Binding ElementName=DescriptionRichTextBox}" Html="{Binding Description, Mode=TwoWay}" />
</StackPanel>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</Window>
(I also tried to change the ItemContainerStyle, but without success)
Hi Telerik,
I'm working with RadControls for WPF Q1 2011 and PRISM 4 - MVVM. I need to add a view into a floating window programmatically. The goal is when my main window displayed, a floating window (another view) will also be displayed. The MVVM module will pass the view into the floating window, hence I need to define a region within the window. Is it possible to achieve and how?
Thank you,
Agung
RadColorSelector
"Automatic", "Theme colors", "Standard colors..." etc...<
telerik:RadGridView x:Name="gvProductData"
Grid.Row="1"
ShowGroupPanel="False"
IsFilteringAllowed="False"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ItemsSource="{Binding FilteredProducts, Mode=TwoWay}"
IsReadOnly="True" AutoGenerateColumns="False"
BorderThickness="0"
HorizontalAlignment="Left"
SelectedItem="{Binding SelectedProduct, Mode=TwoWay}"
Visibility="{Binding GridViewVisibility}"
>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Quick Code" DataMemberBinding="{Binding ProductType}" Width="100" TextWrapping="Wrap" />
<telerik:GridViewDataColumn Header="Description" DataMemberBinding="{Binding ProductName}" Width="*" TextWrapping="Wrap"/>
</telerik:RadGridView.Columns>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Sorting">
<cmd:EventToCommand Command="{Binding Path=OnGridSortCommand}" PassEventArgsToCommand="True">
</cmd:EventToCommand>
</i:EventTrigger>
</i:Interaction.Triggers>
</telerik:RadGridView >
Following is my View Model :
private
void OnGridSortClicked(RoutedEventArgs e)
{
IEnumerable<CustomModelProductSelection> qry = from p in this.Products
orderby p.FavoriteAsEnum, p.ProductDescription
select p;
FilteredProducts =
new List<CustomModelProductSelection>(qry);
}
So here in my view model I can get the column header on which user clicked for sorting from RoutedEventArgs parameter. But ideally i shall not be doing it as it violates the MVVM pattern (ViewModel should not have tightly coupled with view)
Do you know any other way to get the sort column name from grid? like maintaining the header collection and binding to grid..
Thanks!
Dharmesh
BindingExpression BindingExpr = null; |
if (Keyboard.FocusedElement is TextBox) |
{ |
BindingExpr = (Keyboard.FocusedElement as TextBox).GetBindingExpression(TextBox.TextProperty); |
if (BindingExpr != null) |
{ |
BindingExpr.UpdateSource(); |
} |
} |