Home Forums WPF controls Xceed DataGrid for WPF grid column question

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21560 |

    I just took a look at the grid for wpf – good job. Here is a simple question though. I copied your code as an example but I dont get the column headers to have a description. How do I accomplish this with the following code? I want it to say DayofWeek.

    <Window x:Class=”XceedApp1.Window1″
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    Title=”XceedApp1″ Height=”288″ Width=”510″
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221;
    xmlns:s=”clr-namespace:System;assembly=mscorlib”
    >
    <Window.Resources>
    <x:Array x:Key=”data_list” Type=”{x:Type s:String}”>
    <s:String>Sunday</s:String>
    <s:String>Monday</s:String>
    <s:String>Tuesday</s:String>
    <s:String>Wednesday</s:String>
    <s:String>Thursday</s:String>
    <s:String>Friday</s:String>
    <s:String>Saturday</s:String>
    </x:Array>
    </Window.Resources>

    <Grid>
    <xcdg:DataGridControl x:Name=”OrdersGrid” ItemsSource=”{StaticResource data_list}” Margin=”8,1,1,-1″>
    <xcdg:DataGridControl.View>
    <xcdg:TableView ShowRowSelectorPane=”False” HorizontalGridLineThickness=”1″ VerticalGridLineThickness=”1″>
    <xcdg:TableView.HorizontalGridLineBrush>
    <SolidColorBrush Color=”Orange”/>
    </xcdg:TableView.HorizontalGridLineBrush>
    <xcdg:TableView.VerticalGridLineBrush>
    <SolidColorBrush Color=”Orange”/>
    </xcdg:TableView.VerticalGridLineBrush>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>
    </Grid>
    </Window>

    Imported from legacy forums. Posted by keith (had 2987 views)

    User (Old forums)
    Member
    Post count: 23064

    You will need to add the following :

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”.”
    Title=”DayOfWeek”/>
    </xcdg:DataGridControl.Columns>

    Since AutoCreateColumns is set to True (by default), a column will be generated with a field name of “.” (since it is bound to an Array of value type). Therefore, adding the above code will allow you to change/affect the title of the auto-generated column. This is also true for all properties of auto-generated columns.

    Imported from legacy forums. Posted by Matt (had 230 views)

    User (Old forums)
    Member
    Post count: 23064

    sweet…

    Imported from legacy forums. Posted by keith (had 4095 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.