In Windows Vista and Windows 7, my column's labels are truncated when they look just fine in XP.
Here is the grid in XP. Note that the Dose, Unite and Lait(h) columns are displayed correctly.
Here is the exact same grid, on a Vista PC:
What can I do about that?
Just to reduce the variable count, I created a simple test project. Same result:
XP:
Vista:
Is it a xamDataGrid limitation?
Hello,
This could be because of the windows theme (for example Aero). What you can do is create a padding for the content of the LabelPresenter, like this :
<Style TargetType="{x:Type igDP:LabelPresenter}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<ContentPresenter Content="{Binding}" Margin="5" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
You suggest that I add some padding on the right of the LabelPresenter? I'm trying to make my columns as narrow as possible. Adding a Margin would make the colums wider. Anyway, it won't solve the problem. I added a Margin="0,0,0,10" and made the columns larger by 10 in my test app and here's the result:
Ain't it a bug in the grid? Can you reproduce that bug? What can I do to prevent the grid from using the Aero theme?
I am still not able to reproduce this. Below is a screenshot of what I am getting on both XP and Windows 7 :
is it possible to provide us with a sample as well as information on which version you are using and which build.
Your Win7 columns are wider than in XP... Did you set the field widths? I need to have the exact same width on all platforms.
I'm using version 9.2. Here is the code I used to test:
From a new project:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="655" xmlns:igDP="http://infragistics.com/DataPresenter">
<Grid>
<igDP:XamDataGrid Name="xamDataGrid1" VerticalAlignment="Top" DataSource="{Binding}">
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Id" Label="Very long label to say Id" Width="130"/>
<igDP:Field Name="Name" Label="This is another long label for the name" Width="200"/>
<igDP:Field Name="BirthDate" Label="Not so long for the BirthDate" Width="150"/>
<igDP:Field Name="Comment" Label="Any comment?" Width="80"/>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
</Grid>
</Window>
namespace WpfApplication1
{
public partial class Window1 : Window
public Window1()
InitializeComponent();
PersonList = new BindingList<Person>();
Person p = new Person();
p.Id = 1;
p.Name = "Fred";
p.BirthDate = new DateTime(1977, 01, 01);
PersonList.Add(p);
this.DataContext = PersonList;
}
public BindingList<Person> PersonList { get; set; }
public class Person
public int Id { get; set; }
public string Name { get; set; }
public DateTime BirthDate { get; set; }
public string Comment { get; set; }
As I said, this is because of the Windows 7 default theme. The screenshot from my previous post was taken with Windows 7 Aero theme. Here is a screenshot with the Windows Classic theme. You will notice that this is exactly the same as the XP screenshot.
If the Aero theme is causing my problem, isn't there a way I can use a simple template for my column headers that won't be affected by the OS theme? How come the xamDataGrid can't control the way it's displaying the headers? My software has to work with the Aero theme, or the classic theme, and use all the available horizontal space possible.
Fine. You found the cause of the bug. Now, how do I make the xamDatagrid work with the Aero theme now? Like I said before, I need to set my columns width precisely: horizontal space is limited.
Is it possible to make the grid not be affected by the Windows theme? Can't I control the way things are displayed in WPF?