Pane's floating size not considered

8 posts, 0 answers
  1. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 08 Nov 2013 Link to this post

    Hi everyone,

    I am developing a WPF application in which I use RadControls including RadDocking.

    Here is my Docking's layout :

    <?xml version="1.0" encoding="utf-8"?>
        <RadDocking>
          <DocumentHost>
            <RadSplitContainer SerializationTag="m_splitContainer2" Orientation="Vertical">
              <Items>
                <RadPaneGroup SerializationTag="m_paneGroup2" SelectedIndex="-1">
                  <Items />
                </RadPaneGroup>
                <RadPaneGroup SerializationTag="m_paneGroup3" SelectedIndex="-1">
                  <Items />
                </RadPaneGroup>
              </Items>
            </RadSplitContainer>
          </DocumentHost>
          <SplitContainers>
            <RadSplitContainer SerializationTag="m_splitContainer1" Dock="DockedLeft" Width="240">
              <Items>
                <RadPaneGroup SerializationTag="m_paneGroup1" SelectedIndex="-1">
                  <Items />
                </RadPaneGroup>
              </Items>
            </RadSplitContainer>
          </SplitContainers>
        </RadDocking>

    A method is executed at run time to perform the following actions :
    - Create a Pane and place content inside
    - Set the Pane's floating size
    - Dock the Pane into m_paneGroup1

    After the execution of the method I have manually undocked the Pane to make it floating.
    But the Pane's size was not the floating size set in the method.

    Have I misunderstood the behavior of the floating size of a Pane ?

    Thank in advance for your answer.
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 11 Nov 2013 Link to this post

    Hi Pascal,

    Thank you for contacting us.

    We managed to observe the issue and it seems there is a bug in the current version of RadDocking when setting the FloatingSize attached property to a Pane contained in a PaneGroup that has only one Pane. If there are more then one Panes in that PaneGroup no unexpected behavior is observed. We logged this issue in our Public Issue Tracker System where you can track its status. In the meanwhile you can simply set the FloatingSize attached property to the RadPaneGroup if there are no other Panes in it.

    I updated your Telerik points for bringing this to our attention. If you have any other questions feel free to wrote to us again.

    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 12 Nov 2013 Link to this post

    Thank you for your answer.

    I can not set the PaneGroup's floating size because the PaneGroup is created at runtime when I manually undock the Pane.
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 14 Nov 2013 Link to this post

    Hello,

    In order to set the FloatingSize to the PaneGroup when only one Pane is left in it you could do the following:
    • Bind the IsSingleItem of the PaneGroup to the FloatingSize property.
    • Add a IMultiValueConverter to that binding that will convert the values correctly.
    • Pass the PaneGroup itself to the converter using MultiBinding

    We created and attached a sample project for you of the described approach. Hope this is helpful.


    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 14 Nov 2013 Link to this post

    Thank you for your answer.

    I have added the following class into my project :

    public class SingleItemToFloatingSizeConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var panegroup = values[1] as RadPaneGroup;
            var size = RadDocking.GetFloatingSize(panegroup);
            var isSingleItem = (bool)values[0];
            if ((isSingleItem) && (panegroup.EnumeratePanes().Count() > 0))
            {
                size = RadDocking.GetFloatingSize(panegroup.EnumeratePanes().First());
            }
     
            return size;
        }
     
        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    I have added the following block into the markup of my application's resource dictionnary :

    <docking:SingleItemToFloatingSizeConverter x:Key="SingleItemToFloatingSizeConverter" />
    <Style TargetType="telerik:RadPaneGroup">
        <Setter Property="telerik:RadDocking.FloatingSize">
            <Setter.Value>
                <MultiBinding Converter="{StaticResource SingleItemToFloatingSizeConverter}">
                    <Binding Path="IsSingleItem" RelativeSource="{RelativeSource Self}" />
                    <Binding RelativeSource="{RelativeSource Self}" />
                </MultiBinding>
            </Setter.Value>
        </Setter>
    </Style>

    I have launched my application.
    The following actions have been automatically performed by the application :
    - Create a Pane and place content inside
    - Dock the Pane into a PaneGroup
    - Set the Pane's floating size

    The attached picture 1.png shows the main window at this step.

    Then I have set a breakpoint on the following line in the Convert method of the SingleItemToFloatingSizeConverter class :

    size = RadDocking.GetFloatingSize(panegroup.EnumeratePanes().First());

    Then I have manually undocked the Pane.
    The breakpoint has been hitted and the result size was (Width = 234 ; Height = 757).

    The attached picture 2.png shows the main window at this step.
    The PaneGroup's size is smaller than the result size of the Convert method.
    Can you please explain me why ?
  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 15 Nov 2013 Link to this post

    Hello Pascal,

    The row you are referring in the SingleItemToFloatingSizeConverter is not the size that is used for the FloatingSize when only one Pane is left in a RadPaneGroup. The size that is used is it the one from the " if (isSingleItem) " condition. Actually the first Size is not used anywhere in the previously attached example project, we simply added it in order not to return Size(0, 0) when there are multiple Panes in the PaneGroup.

    I recorded a short video for you that shows that the size that is returned in that converter when only one Pane is left in a PaneGroup is the correct one that is set as FloatingSize to the Pane. Hope this clears how the custom converter works. If you have any other questions feel free to write to us in the future.

    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 18 Nov 2013 Link to this post

    Thank you for your answer.

    I have mentionned this line in my previous post :

    size = RadDocking.GetFloatingSize(panegroup.EnumeratePanes().First());

    And the line comes from the following code block :

    if ((isSingleItem) && (panegroup.EnumeratePanes().Count() > 0))
    {
        size = RadDocking.GetFloatingSize(panegroup.EnumeratePanes().First());
    }

    Consequently I do not understand the following part of your previous post :

    The row you are referring in the SingleItemToFloatingSizeConverter is not the size that is used for the FloatingSize when only one Pane is left in a RadPaneGroup. The size that is used is it the one from the " if (isSingleItem) " condition.

    Can you rephrase the above part ?

    Thank you in advance for your answer.
  9. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 19 Nov 2013 Link to this post

    Hi,

    I misunderstood the row you were referring earlier with the 17 line for which my last remark was made. The 21 line in the convert ( size = RadDocking.GetFloatingSize(panegroup.EnumeratePanes().First()); ) is correctly set when the project is executed on our side which caused the misunderstanding. As the previously attached video shows that row is correctly set to 200, 100 size.

    Regarding my last remark what I meant was that you can remove the 17 line var size = RadDocking.GetFloatingSize(panegroup); and replace it with var size = new Size(0, 0); as it is not used in the example. As previously mentioned the goal of the sample project was to show a way to set the FloatingSize to Pane when it is the only Pane left in the PaneGroup.

    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready