Can't compile pane.GetParentToolWindow()

2 posts, 0 answers
  1. KA
    KA avatar
    7 posts
    Member since:
    Jan 2013

    Posted 29 Jan 2013 Link to this post

    Hello,

    i am trying to resize a radPane to fit its content when it's state changed to floating. I read in this forum that i should get the parent window and set the size of the parent toolwindow manually, but i cannot compile it:

    'TelerikRadPaneTest.CustomPane' does not contain a definition for 'GetParentToolWindow' and no extension method 'GetParentToolWindow' accepting a first argument of type 'TelerikRadPaneTest.CustomPane' could be found (are you missing a using directive or an assembly reference?)



    According to the official API the method should be in the assembly i am using:
    2012.3.1129.40 Telerik.Windows.Controls
    2012.3.1129.40 Telerik.Windows.Controls.Data
    2012.3.1129.40 Telerik.Controls.Docking
    2012.3.1129.40 Telerik.Controls.Navigation


    MainWindow.xaml

    <Window x:Class="TelerikRadPaneTest.MainWindow"
            xmlns:c="clr-namespace:TelerikRadPaneTest"
            Title="MainWindow" Height="350" Width="525">
        <DockPanel>
            <telerik:RadDocking PaneStateChange="RadDocking_PaneStateChange_1" telerik:AnimationManager.IsAnimationEnabled="False" HasDocumentHost="False" Margin="0,50,0,0" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"  Grid.RowSpan="2" telerik:StyleManager.Theme="Windows8" BorderThickness="0">
     
                <telerik:RadSplitContainer telerik:ProportionalStackPanel.RelativeSize="120, 200" MinWidth="450" InitialPosition="DockedLeft" telerik:StyleManager.Theme="Windows8">
                    <telerik:RadPaneGroup>
                        <c:CustomPane CanUserPin="False" CanUserClose="False">
                            <ScrollViewer>
                                <TextBlock Text="Very Long Scrollable Text"/>
                            </ScrollViewer>
                        </c:CustomPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>
        </DockPanel>
    </Window>

    MainWindow.xaml.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Telerik.Windows.Controls;
     
    namespace TelerikRadPaneTest
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
     
            private void RadDocking_PaneStateChange_1(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                var radDock = sender as RadDocking;
                if (radDock.IsLayoutChanging)
                {
                    var pane = e.OriginalSource as CustomPane;
                    if (pane != null)
                    {
                        var scrollviewer = pane.Content as ScrollViewer;
                        var view = scrollviewer.Content as TextBlock;
                        Size size = new Size(view.ActualWidth, view.ActualHeight);
                        Point loc = radDock.PointToScreen(new Point(0, 0));
     
                        //start, this won't compile
     
                        var win = pane.GetParentToolWindow();
                        //win.Width = size.Width;
                        //win.Height = size.Height;
     
                        //end
                    }
                }
            }
        }
    }

    CustomPane.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Telerik.Windows.Controls;
     
    namespace TelerikRadPaneTest
    {
        public class CustomPane : RadPane
        {
            public CustomPane()
                : base()
            {
                base.ContextMenuTemplate = null;
            }
     
            protected override void OnMouseEnter(System.Windows.Input.MouseEventArgs e)
            {
                this.ChangeVisualState(true);
            }
     
     
            protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e)
            {
                base.OnMouseUp(e);
     
                if (!this.IsPinned)
                {
                    this.IsPinned = true;
                }
            }
     
     
        }
     
    }
  2. KA
    KA avatar
    7 posts
    Member since:
    Jan 2013

    Posted 29 Jan 2013 Link to this post

    ok i just figured it out.
    should have read the api description carefully in the first place..

    i was missing an explicit

    using Telerik.Windows.Controls.Docking;
    as this is an extension Method

    no compile errors any more
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top