or
<tel:RadGridView x:Name="ListsGV" Grid.Row="2" ItemsSource="{Binding EditFormViewModelCollection}" IsReadOnly="True" SelectedItem="{Binding CurrentEditFormViewModel}" PreviewMouseDoubleClick="gridView_PreviewMouseDoubleClick" HeaderRowStyle="{StaticResource HeaderStyle}" CanUserSortColumns="False"> <prism:CommandBehaviorCollection.Behaviors> <prism:BehaviorBinding Event="MouseDoubleClick" Command="{Binding TableSelectedDoubleClickCommand}" CommandParameter="{Binding ElementName=ListsGV, Path=CurrentItem}" /> </prism:CommandBehaviorCollection.Behaviors> <tel:RadGridView.GroupDescriptors> <tel:GroupDescriptor Member="CurrentList.SystemModule" /> </tel:RadGridView.GroupDescriptors> <tel:RadGridView.GroupHeaderTemplate> <DataTemplate> <TextBlock Text="{Binding Header.Description}" Margin="1,0,0,0" /> </DataTemplate> </tel:RadGridView.GroupHeaderTemplate> <tel:RadGridView.Columns> <tel:GridViewDataColumn Header="Description" DataMemberBinding="{Binding CurrentList.Description}" HeaderCellStyle="{StaticResource HeaderCell}" MinWidth="300" /> <tel:GridViewDataColumn Header="Shared Operations" DataMemberBinding="{Binding CurrentList.SharedOperation}" HeaderCellStyle="{StaticResource HeaderCell}" Width="*"/> </tel:RadGridView.Columns></tel:RadGridView>I'm having an issue with column header wrapping due to my headers being bound to the DisplayName attribute of my properties.
I have a Property in my view model, using the DisplayName attribute:
[DisplayName("Component Item Identifier")] public String ComponentItem { get { return componentItem; } set { ... } } <telerikGrid:GridViewDataColumn UniqueName="ComponentItem" DataMemberBinding="{Binding Path=ComponentItem}" Header="{Binding Path=ComponentItem.DisplayName}" > </telerikGrid:GridViewDataColumn><telerikGrid:GridViewDataColumn UniqueName="ComponentItem"DataMemberBinding="{Binding Path=ComponentItem}"> <telerikGrid:GridViewDataColumn.Header> <Grid> <TextBlock Text="MY LONG TEXT FOR TESTING WRAPPING" TextWrapping="Wrap"/> </Grid> </telerikGrid:GridViewDataColumn.Header> </telerikGrid:GridViewDataColumn><telerikGrid:GridViewDataColumn UniqueName="ComponentItem"DataMemberBinding="{Binding Path=ComponentItem}"> <telerikGrid:GridViewDataColumn.Header> <Grid> <TextBlock Text="{Binding Path=ComponentItem.DisplayName}" TextWrapping="Wrap"/> </Grid> </telerikGrid:GridViewDataColumn.Header> </telerikGrid:GridViewDataColumn>public void refreshList() { MySqlConnection conn = new MySqlConnection(connString); personList.Clear(); using (conn) { String sql = "SELECT * FROM personeel ORDER BY Naam;"; MySqlCommand cmd = new MySqlCommand(sql, conn); conn.Open(); MySqlDataReader reader = cmd.ExecuteReader(); StringBuilder htmlStr = new StringBuilder(""); while (reader.Read()) { String Naam = htmlStr.Append(reader["Naam"]).ToString(); htmlStr.Clear(); String Voornaam = htmlStr.Append(reader["Voornaam"]).ToString(); htmlStr.Clear(); String Gsm = htmlStr.Append("0" + reader["GSM"]).ToString(); htmlStr.Clear(); personList.Add(new Person(Voornaam, Naam, Gsm)); } conn.Close(); } //gridView1 = new Telerik.Windows.Controls.RadGridView(); gridView1.ItemsSource = personList; //CollectionViewSource.GetDefaultView(gridView1.ItemsSource).Refresh(); } <telerik:RadDocking BorderBrush="{x:Null}" BorderThickness="0" Padding="0" Name="_dock" Margin="0"> <telerik:RadSplitContainer Name="_splitContainer" Width="450"> <telerik:RadPaneGroup TabStripPlacement="Right" TabOrientation="Horizontal"> <telerik:RadPane Header="Item Image" Content="This is an item image" /> <telerik:RadPane Header="Tags" Content="These are the tags" /> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking>
<telerik:RadDropDownButton x:Name="PART_DropDownButton" CloseOnEnter="True" Grid.Column="1" DropDownIndicatorVisibility="Collapsed" Focusable="False" telerik:DateTimePickerExtensions.FocusContentOnOpen="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsTabStop="False" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="-1,0,0,0" Padding="0" PopupPlacementTarget="{Binding ElementName=PART_DateTimeInput}" TabIndex="1" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch"><telerik:RadDropDownButton.DropDownContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="33"/>
</Grid.RowDefinitions>
<telerik:RadCalendar x:Name="PART_Calendar"
Culture="{TemplateBinding Culture}"
Grid.Column="0"
DisplayDateEnd="{Binding DisplayDateEnd, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" DateSelectionMode="{TemplateBinding DateSelectionMode}"
DisplayDateStart="{Binding DisplayDateStart, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" DisplayDate="{Binding DisplayDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
IsReadOnly="{TemplateBinding IsReadOnly}"
Grid.Row="0"
Style="{TemplateBinding CalendarStyle}"
SelectableDateEnd="{Binding SelectableDateEnd, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
SelectionMode="Single"
SelectedDate="{Binding SelectedDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
SelectableDateStart="{Binding SelectableDateStart, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
</telerik:RadCalendar>
<telerik:DateTimePickerClock x:Name="PART_Clock" Culture="{TemplateBinding Culture}" Grid.Column="1" EndTime="{TemplateBinding EndTime}" Header="Clock" IsReadOnly="{TemplateBinding IsReadOnly}" Grid.Row="0" Style="{TemplateBinding ClockStyle}" SelectedTime="{Binding SelectedTime, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" StartTime="{TemplateBinding StartTime}" TimeInterval="{Binding TimeInterval, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
</telerik:DateTimePickerClock>
<StackPanel Grid.Row="2" Background="#ABACA7" >
<Border BorderThickness="1" Grid.Row="2" VerticalAlignment="Top" BorderBrush="whitesmoke" Margin="1" >
<Button Style="{StaticResource DatePickerButton}" Content="Today" />
</Border>
</StackPanel>
<!--Date Picker Button Style -->
<Style x:Key="DatePickerButton" TargetType="Button">
<Setter Property="Background" Value="#E0E0DE" />
<Setter Property="BorderBrush" Value="#91918F"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property = "HorizontalAlignment" Value="Center"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Width" Value="50"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="ExtraBold"/>
<Setter Property= "Margin" Value="2"/>
<Setter Property= "Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
CornerRadius="2.8"
>
<ContentControl Content="{TemplateBinding Content}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource SecondaryMouseOverColor}"/>
<Setter Property="BorderBrush" Value="Gold"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="{StaticResource SecondaryMouseOverColor}"/>
<Setter Property="BorderBrush" Value="Orange"/>
</Trigger>
</Style.Triggers>
</Style>