Home Forums WPF controls Xceed DataGrid for WPF master-detail: hide ‘collapse/expand’ button + no child rows

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • Xceed Support
    Member
    Post count: 5658

    Can you send me an application that reproduces the behavior you are reporting? I am not able to reproduce it here.

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

    User (Old forums)
    Member
    Post count: 23064

    hi, recently i’ve solved problem howto hide columnManagerRow for empty details and jenny pointed me to the same example in master-detail sample.

    finally i achived it with simple style, as u can see in here: http://xceed.com/CS/forums/thread/22603.aspx

     

    suppose to hide expand/collapse button could not be solved so easily, however pls post your solution (when u finish it) as it can be helpfull to others as well, including me, tnx [:D]

     

    Imported from legacy forums. Posted by p1n (had 846 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks p1n, though the issue here is that there is no way to
    directly target the toggle button with a style without applying a
    control template to the entire Row object.  I hope Xceed considers
    making the detail toggle more easily configurable in a future release,
    or perhaps even changes the default behavior.

    Jenny, I was
    able to get the example working when I moved it into a separate
    application, so there must be something in our code that’s interfering
    with the use of the DataGridContext. Still having some trouble with the
    control template, but I’m going to attempt to make some more progress
    on my own.  I’ll report back if I find a solution or run into another
    roadblock.  Do you know if there are any plans to make this easier in a
    future release?  Even if I get the control template working, it’s still
    not the most desirable long-term solution, as it re-implements a
    portion of the control which could limit functionality in the future,
    and increases maintenance complexity as it may require us to manually
    tweak things which would normally be intrinsic to the grid.  I do very
    much appreciate all the help, though.

    Imported from legacy forums. Posted by Matusz (had 1279 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi all,

     I also need to hide “details” toogle button when details table is void. I successfully used style what Jenny placed here: http://xceed.com/CS/files/folders/jenny/entry18669.aspx but have one problem – when I change sort order in column with toggle button, buttons visibility become invalid. Can anybody help me? Code’s listed below:

     // Part of data row style

    <!– TRIGGER FOR TOGGLE BUTTON VISIBILITY. “DEPENDANTON” PROPERTY CAN BE CHANGED TO ANY OTHER PROPERTY.–>

    <DataTrigger Binding=”{Binding Path=(xcdg:DataGridControl.DataGridContext), Converter = {StaticResource converter}, RelativeSource={RelativeSource Self}}”

    Value=”False”>

    <Setter TargetName=”detailsToggle”

    Property=”Visibility”

    Value=”Hidden” />

    </DataTrigger>

     

     // converter

    [ValueConversion(typeof(Object), typeof(bool))]
        class ObjectToBooleanConverter : IValueConverter
        {
            #region IValueConverter Members

            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                bool result = true;
                if (value != null)
                {
                    try
                    {
                        DataGridContext inputValue = (DataGridContext)value;
                        result = (inputValue.CurrentItem != null && ((MasterDetailGridSample.Window1.MasterData) inputValue.DataGridControl.CurrentItem).detailGridRows.Count > 0);
                    }
                    catch { }
                }
                return result;
            }

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                return null;
            }

            #endregion
        }

    Imported from legacy forums. Posted by Tatyana (had 1156 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Tatyana,

    In the converter class, modify the Convert method to look like this:

       public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
       {
          bool result = true;
          MasterDetailGridSample.Window1.MasterData sourceData = value as MasterDetailGridSample.Window1.MasterData;

          if( sourceData != null )
          {
             try
             {
                result = ( ( sourceData.detailGridRows != null ) && ( sourceData.detailGridRows.Count > 0 ) );
             }
             catch
             {
             }
          }
          return result;
        }

    and the Trigger code should look like this:

       <!– TRIGGER FOR TOGGLE BUTTON VISIBILITY. “DEPENDANTON” PROPERTY CAN BE CHANGED TO ANY OTHER PROPERTY. –>
       <DataTrigger Binding=”{Binding RelativeSource={RelativeSource Self}, Path=DataContext, Converter = {StaticResource converter}}”
                    Value=”False”>
          <Setter TargetName=”detailsToggle”
                  Property=”Visibility”
                  Value=”Hidden” />
       </DataTrigger>

     

    Imported from legacy forums. Posted by Diane [Xceed] (had 1669 views)

    User (Old forums)
    Member
    Post count: 23064

    Its been a while since all of these posts were made.  I’m very nervous about using the code that Jenny provided (at “http://xceed.com/CS/files/folders/18669/download.aspx&#8221;), as it is so old.  In fact, I don’t think it works any more, as there isn’t a “Row” object that is accessible in the xcdg namespace anymore that the ControlTemplate can target for its TargetType.

    I attempted to use Blend 2 to extract a new ControlTemplate, but it couldn’t pull it out of the referenced dll.  Is there an easy way to do this without purchasing the Blueprint edition (which the boss won’t do)?

    Could somebody at Xceed repost an updated code sample of “http://xceed.com/CS/files/folders/18669/download.aspx&#8221;?

    Lastly, I don’t like the idea of replacing the ControlTemplate, as I then become out of sync with any future changes.  I wish there was something that could be done on the Xceed side so that I could just tell the grid to not show the expansion glyph if there are no rows.  Better yet, that should be the default behavior of the Grid!

    I wish there was a better interface definition (either in the DataGridDetailDescription class or elsewhere) so that the relationship could more easily report the presence of child rows, so that the grid know to show the expansion glyph or not.

    Imported from legacy forums. Posted by Ryan (had 1212 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Ryan,

    The sample project should still be valid. While we don’t have a Row object within the xcdg namespace, the xcdg:DataRow derives from Row, and so the ControlTemplate should still work.

    I did however submit a feature request to the development team to indicate your feedback and ask them if they can add something to make it easier to achieve this behavior. Perhaps even a simple property that when toggled, would automatically provide that behavior, with everything done internally by us. That would surely be ideal, but it will be up to the development team to decide what will work best with our code.

    I added a link to this forum thread in the feature request, and so an update should be posted here when the feature becomes available.

    In the meantime, if you need help implementing the code from the provided sample project in your own project, you can send your questions to support@xceed.com

     

    Imported from legacy forums. Posted by Diane [Xceed] (had 1271 views)

    User (Old forums)
    Member
    Post count: 23064

    Is there anything new on this? I can’t believe it requires so much code to just hide the expand glyph. I also don’t want to use that solution and feel it should be default behavior of the grid as well. Is there not a simplier way than all of that code here: http://xceed.com/CS/files/folders/18669/download.aspx?

     

    Thanks.

    Imported from legacy forums. Posted by gtd7791 (had 492 views)

    Xceed Support
    Member
    Post count: 5658

    Hi,

    There is no other way of achieving this. Another way of doing this is to redo the template of the DataRow and to add the following Trigger to it:

    <DataTrigger Binding=”{Binding Path=HasChildRows}” Value=”False”>
        <Setter TargetName=”detailsToggle” Property=”Visibility” Value=”Hidden” />
      </DataTrigger>

    Instead of using a converter to do this, you can add a HasChildRows property to your business object which would return a true/false boolean value depending if the current object had child rows. For the time being, this behavior will not be the default behavior of the DataRow.

    Imported from legacy forums. Posted by Marc [Xceed] (had 1601 views)

Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.