Home Forums WPF controls Xceed DataGrid for WPF Column.Visible Bug

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

    Hello I found a nother bug:
    I added some code to support showing and hiding columns.
    at first I add code to showall and hideall:

    internal void HandleShowHideAllColumns(bool visible)
    {
    foreach (Column column in grid.Columns)
    {
    column.Visible = visible;
    }
    }

    try this and u’ll see that the hide works but when I hit show all again the rows are hidden in a weired way.

    Itzik

    Imported from legacy forums. Posted by Itzik (had 5877 views)

    Xceed Support
    Member
    Post count: 5658

    There effectively seems to be a bug there… Thanks for reporting this. We’ll try to fix this issue in an upcoming version.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 1277 views)

    User (Old forums)
    Member
    Post count: 23064

    FYI I am doing a similar thing, but rather than showing or hiding columns, I add and remove them and it works fine

    <xcdg:DataGridControl Name=”servicesList” ItemsSource=”{Binding Path=Services}” AutoCreateColumns=”False” ReadOnly=”True” NavigationBehavior=”RowOnly”>

    <xcdg:DataGridControl.Resources>
    <syscollections:ArrayList x:Key=”AdvancedColumns”>
    <xcdg:Column FieldName=”Statistics.WhenLastPublished” Title=”Last Published” DisplayMemberBinding=”{Binding Path=Statistics.WhenLastPublished, Converter={StaticResource DateTimeConverter}}” Width=”100″ />
    <xcdg:Column FieldName=”Statistics.YieldSetCount” Title=”Yield Sets” DisplayMemberBinding=”{Binding Path=Statistics.YieldSetCount}” Width=”100″ />
    <xcdg:Column FieldName=”Statistics.WeightingSetCount” Title=”Weighting Sets” DisplayMemberBinding=”{Binding Path=Statistics.WeightingSetCount}” Width=”100″ />
    <xcdg:Column FieldName=”Statistics.PublishingSetCount” Title=”Policies” DisplayMemberBinding=”{Binding Path=Statistics.PublishingSetCount}” Width=”100″ />
    <xcdg:Column FieldName=”Statistics.LivePublishingSetCount” Title=”Published or Live Policies” DisplayMemberBinding=”{Binding Path=Statistics.LivePublishingSetCount}” Width=”150″ />
    </syscollections:ArrayList>
    </xcdg:DataGridControl.Resources>

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”ServiceIdentifier.ServiceBrand” Title=”Brand” DisplayMemberBinding=”{Binding Path=ServiceIdentifier.ServiceBrand}” Width=”70″ />
    <xcdg:Column FieldName=”ServiceIdentifier.ServiceNumber” Title=”Number” DisplayMemberBinding=”{Binding Path=ServiceIdentifier.ServiceNumber}” Width=”70″ />
    <xcdg:Column FieldName=”Description” Title=”Description” DisplayMemberBinding=”{Binding Path=Description}” Width=”300″ />
    <xcdg:Column FieldName=”Statistics.WhenLastModified” Title=”Last Modified” DisplayMemberBinding=”{Binding Path=Statistics.WhenLastModified, Converter={StaticResource DateTimeConverter}}” Width=”100″ />
    </xcdg:DataGridControl.Columns>
    <xcdg:DataGridControl>

    Then in the codebehind

    ArrayList advancedColumns = (ArrayList) servicesList.FindResource(“AdvancedColumns”);

    if ((bool) e.NewValue)
    {
    // Add the advanced columns to the grid
    foreach (Column column in advancedColumns)
    {
    serviceList.servicesList.Columns.Add(column);
    }
    }
    else
    {
    // Remove the advanced columns from the grid
    foreach (Column column in advancedColumns)
    {
    serviceList.servicesList.Columns.Remove(column);
    }
    }

    Imported from legacy forums. Posted by nmosafi (had 804 views)

    User (Old forums)
    Member
    Post count: 23064

    thanks

    Imported from legacy forums. Posted by Itzik (had 794 views)

    User (Old forums)
    Member
    Post count: 23064

    This issue has been resolved, you can obtain the latest version <a href=”http://download3.xceedsoft.com/Packages/3.0.7264.16200/XceedComponents.exe”>here</a&gt;

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

    User (Old forums)
    Member
    Post count: 23064

    Hi,

     I am trying to bind the  IsChecked property of a checkbox to the Visible property of a column in the data grid.  This XAML doesn’t seem to work.

    <xcdg:Column FieldName=”Freight” Visible=”{Binding ElementName=chkBox, Path=IsChecked}” />

     Doesn’t anyone know how to do something like this?

    Imported from legacy forums. Posted by Wei (had 1018 views)

    User (Old forums)
    Member
    Post count: 23064

    I am trying to do this as well and I just cannot get it to work. Is this a bug? Is the visibility being overridden sometime later after the binding?

     

    Imported from legacy forums. Posted by Mark (had 953 views)

    User (Old forums)
    Member
    Post count: 23064

    Anyone? Is this not possible?

    Imported from legacy forums. Posted by Mark (had 894 views)

    Xceed Support
    Member
    Post count: 5658

    Do you have any binding errors in the output window?

    Imported from legacy forums. Posted by Jenny [Xceed] (had 423 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes (now that I look)

    System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=IsChecked; DataItem=null; target element is ‘Column’ (HashCode=44247136); target property is ‘Visible’ (type ‘Boolean’)

    Does this help at all? Is it a scope issue? The grid is inside a Tab Control but I have tested putting another checkbox in the tab and binding its checked state to the same source and that works ok!

     

    Imported from legacy forums. Posted by Mark (had 967 views)

    Xceed Support
    Member
    Post count: 5658

    This is normal behavior since columns are not in the visual tree. This post (http://www.drwpf.com/Blog/Default.aspx?tabid=36&EntryID=36) on Dr.Wpf explains why.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 413 views)

    User (Old forums)
    Member
    Post count: 23064

    By “normal behavior” do you mean then that it is not possible?

    Imported from legacy forums. Posted by Mark (had 643 views)

    Xceed Support
    Member
    Post count: 5658

    Correct. This is not possible.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 478 views)

    User (Old forums)
    Member
    Post count: 23064

    Hmmm. So can you give any hints on how to achieve this? Styles on the column, DataTriggers etc? I can change the Visible property in the code behind but I want it bound to the data.

    Imported from legacy forums. Posted by Mark (had 977 views)

    Xceed Support
    Member
    Post count: 5658

    It is not possible to style a column because it is not a FrameworkElement. Unfortunately, I do not have a solution to provide you with.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 521 views)

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