Home Forums WPF controls Xceed DataGrid for WPF Applying Theme and changing Column Headers

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Mattd [Xceed]
    Keymaster
    Post count: 8
    #25969 |

    Good morning Team,

    I am new to WPF and was wondering the following:

    1) In the Visual Studio template how do we assign one of the themes to the datagrid. It would have been nice to have created a basic form that showed it. Also it creates a class but there is nothing in it so what was it meant to do ?

    2) When a column is Read-Only I want to set the text color of the column header to another color than black. Is there a way to do this in XAML or C# or both ?

    Thanks…. Your control is awesome !

    Imported from legacy forums. Posted by Mathieu (had 2010 views)

    User (Old forums)
    Member
    Post count: 23064

    1) The theme can be applied from XAML or from code behind

    In XAML:

    <Window x:Class=”TestXceed.Window1″
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221;
    xmlns:testStyle=”clr-namespace:Office2007Tutorial;assembly=Office2007Tutorial”
    Title=”TestXceed” Height=”300″ Width=”300″
    >

    <xcdg:DataGridControl x:Name=”TestGrid”>
    <xcdg:DataGridControl.View>
    <xcdg:TableView>
    <xcdg:TableView.Theme>
    <testStyle:Office2007TutorialTheme/>
    </xcdg:TableView.Theme>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>

    where Office2007Tutorial is the custom theme project. U need the class to be able to create an object of this theme project.

    In code-behind:

    TableView tableView = new TableView();
    Theme newTheme = new Office2007Tutorial.Office2007TutorialTheme();
    tableView.Theme = newTheme;
    TestGrid.View = tableView;

    where TestGrid is the name of ur grid

    2) I think you will have to modify the templates to achieve this. There is a tutorial in the documentation on how you could modify templates.. try looking through that to have a overview.

    Good luck! 🙂

    Imported from legacy forums. Posted by Serene (had 3392 views)

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