This is a migrated thread and some comments may be shown as answers.

Databinding broken on RadPane selection change

18 Answers 519 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 26 Jan 2011, 12:51 AM
Hi,
I'm currently using Telerik RadDocking to create an application which uses Prism, and MEF.
I'm using the region adapter recommended for adapting RadPanes to "regions".
I have two panes that are correctly added to the "bottom" region:
1)  First pane (Console) has a TextBox which is bound to a string property, StringContent, in the data context.
2)  Second pane (Errors List) has a DataGrid which is bound to an IEnumerable property, Errors, in the data context.
The panes have their data context set using MEF Import statements, in the XAML code behind:
[Import]
[SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly", Justification = "Needs to be a property to be composed by MEF")]
SampleViewModel ViewModel
{
    set
    {
        this.DataContext = value;
    }
}

When I first launch the application, the Console pane is selected in the bottom region, and the StringContent is correctly displayed in the TextBox.  When I select the Errors List pane (clicking the tab), the datagrid is properly filled.

However, when I go BACK to the Console pane, it is no longer updating/showing the StringContent value in the TextBox.  Similarly, if I navigate BACK to the Errors List pane, it is no longer showing the Errors contents.  Using Snoop, I was able to find the following error:
System.Windows.Data Error: 40 : BindingExpression path error: 'StringContent' property not found on 'object' ''ErrorListViewModel' (HashCode=14361357)'. BindingExpression:Path=StringContent; DataItem='ErrorListViewModel' (HashCode=14361357); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')

You can see here, that it appears that the data context of the panes are somehow getting switched during tab navigation.  Obviously this bug breaks both panes, as they are no longer capable of displaying the correct data to the end user.
What do you recommend for resolving this?

Thanks.

18 Answers, 1 is accepted

Sort by
0
Accepted
Philip
Top achievements
Rank 1
answered on 26 Jan 2011, 09:37 AM
Hi Aaron,

I've just met a similar issue with the RadDocumentPane. Placing an AdornerDecorator as the single child inside the pane, placing all other elements inside the AdornerDecorator, and finally setting the AdornerDecorator's DataContext instead of the Pane's solved the problem.

If you want to bind the Pane's Header to the Viewmodel, you can set the Pane's DataContext in addition to that of the AdornerDecorator.

Hope this helps, Cheers,
Phil
0
Aaron
Top achievements
Rank 1
answered on 26 Jan 2011, 07:30 PM
Hi Phil,
Thanks for this! The AdornerDecorator workaround solved the problem.  You saved me from more than a few headaches :D
Thanks again.
0
YYZRichard
Top achievements
Rank 2
answered on 07 Feb 2011, 03:47 AM
Could you please post an example? I'm having the same problem.
Thank you.
0
Philip
Top achievements
Rank 1
answered on 07 Feb 2011, 09:56 AM
Sure,

I am instantiating the DocumentPane in code, which looks something like the code below.
Please note that the important part is between the two comment lines. Before is just the setup of the view, beyond the comment lines is a simple method to add the pane to the docking. For further info, see Karl Shifflet's blog at WPF Validation Errors Disappear Inside TabControl When Switching TabItems


            
            object viewmodel = someviewmodel.....
var
 document = Spawn(viewKey); You will need to change this line. Spawn() returns my actual views which are just XAML based User Controls
var
 container = new RadDocumentPane();
            container.Header = "Some Header";
            container.Content = "loading...";
            container.CanDockInDocumentHost = true;
            container.CanUserPin = false;           

            // ATTN: WORKAROUND FOR TELERIK DATACONTEXT ISSUE, DUPLICATE DATACONTEXT REQUIRED!
            var decorator = new AdornerDecorator();
            container.DataContext = viewmodel;
            document.DataContext = viewmodel;
            container.Content = decorator;
            decorator.Child = document;
            // ATTN: WORKAROUND FOR TELERIK DATACONTEXT ISSUE, DUPLICATE DATACONTEXT REQUIRED! container.SetBinding(RadDocumentPane.HeaderProperty, "Header"); Fill in your own property path here if needed...
            var sc = Dock.DocumentHost as RadSplitContainer;

            if (sc == null)
            {
                sc = new RadSplitContainer();
                Dock.Items.Add(sc);
            }

            var grp = sc.Items.OfType<RadPaneGroup>().FirstOrDefault();
            if (grp == null)
            {
                var agrp = grp;
                grp = new RadPaneGroup();
                sc.Items.Add(grp);
            }

            grp.Items.Add(container);
Naturally, you can do the same thing in xaml with probably even fewer lines.
What you should be aware of is that this approach effectively removes the UI virtualization inherent in the Tabcontrol, so you really don't want to do this with many concurrent Panes. ;)

HTH, Phil
0
YYZRichard
Top achievements
Rank 2
answered on 08 Feb 2011, 05:29 AM
Thanks Philip for providing an example. After a few tries, I was able to get away with XAML and a few lines of code.

The following example uses PRISM 4 MEF.

<telerik:RadPane x:Class="AAA.BBB.Modules.Module1.Views.SampleView"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 xmlns:tk="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 x:Name="grid"
                 mc:Ignorable="d" 
                 d:DesignHeight="182" d:DesignWidth="311" CanUserPin="False">
    <AdornerDecorator x:Name="Decorator">
        <Grid>
            <TextBox Text="Hello world."  />
        </Grid>
    </AdornerDecorator>
</telerik:RadPane>

and here's the SampleView code behind:
 
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Docking;
  
namespace AAA.BBB.Modules.Module1.Views
{
    /// <summary>
    /// Interaction logic for ContentView.xaml
    /// </summary>
    //[Infrastructure.Behaviours.ViewExport(RegionName = Infrastructure.UI.RegionNames.FloatRegion)]
    [Infrastructure.Behaviours.ViewExport("SampleView")]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public partial class SampleView : RadPane
    {
        public ContentView()
        {
            this.InitializeComponent();
        }
  
        /// <summary>
        /// Sets the ViewModel.
        /// </summary>
        /// <remarks>
        /// This set-only property is annotated with the <see cref="ImportAttribute"/> so it is injected by MEF with
        /// the appropriate view model.
        /// </remarks>
        [Import]
        [SuppressMessage("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly", Justification = "Needs to be a property to be composed by MEF")]
        ContentViewModel ViewModel
        {
            set
            {
                // TELERIK workaround to maintain DataBinding
                this.Decorator.DataContext = value;
                //this.DataContext = value;
            }
        }
  
    }
}

To inject the view on RadPaneGroup, I created a service for the module that is hosting the view. This service can be invoked from any other module, it has some logic to set focus to a pane instead of opening duplicated items, but the statements that inject the view are:

// Instantiate a new Pane and set attributes
var pane = new Views.SampleView() { Tag = ID, Title = ID, ToolTip = "Add your tooltip here" };
  
// Inject the view in the RadPaneGroup
regionManager.Regions[Infrastructure.UI.RegionNames.WorkRegion].Add(pane);


For those of you looking for a Region Adapter for RadDocking, check out the link below:
http://www.telerik.com/community/forums/wpf/docking/raddocking-with-prism-4-mvvm-mefbootstrapper.aspx
0
Thomas
Top achievements
Rank 1
answered on 31 Jan 2012, 09:15 PM
Hi Everyone,

The biggest mystery with this issue is that Telerik has not responded or posted anything for this issue (that I was able to find). This is a pretty big problem to have the databinding being broken since data binding is a major part of WPF and Silverlight. It still exists in the latest version (2011.3.1220.40) of the Telerik controls which I am using. Telerik please throw us a bone here and at least let us know that you are aware of this issue and are working on a viable solution that is not a complete hack workaround.

I too have come across this issue without successfully finding a solution that is not a hack and can be considered long-term. The application I am working on implements Prism and MEF so I've built a DockingRegionAdapter similar to the others posted here. I say similar because I rarely find anything that works for individual needs right out of the box. I use UserControls for all of my views and they get set as the content of the RadPane in the adapter through Prism view injection.

What I have found is that the datacontext does not appear to be cleared out but the bindings do. If you check the RadPane objects in the handler for the PaneStateChange event, which is fired when a pane state changes to floating or to docked, you can see that the datacontext is intact but properties that were data bound are not set. An example is the Title property which originally has the data bound value but is null once the pane state changes. Because of this if I try to use a style for these properties they only get used on initial loading of the view and then get wiped out when the pane state changes.

The workarounds proposed here did not work for my situation because they required too much rework of the adapter as region view objects are added or removed from the docking regions. What I ended using as a solution is still a hack but limits the scope of the changes. The fix was to set the property bindings in the adapter for the properties I needed. For some reason the data bindings do not get broken when you set them in code. As I said, this is a hack but so are the other solutions. I am just offering another option so you don't have to make such wide spread changes to make this functionality work. I have one method in my adapter that sets the bindings for each pane as they are created. This method is called in one place from the CreatePane method in the adapter.

The biggest issue with this solution is that the datacontext needs to have a property matching each RadPane property that you want to bind to. The adapter should not know about this type of mapping but as I said these solutions are not good long-term fixes. The real issue needs to be fixed by Telerik or they need to at least give a workaround that is not a hack and explain the issue.

Example from adapter:
private static FrameworkElement CreatePane(ItemsControl regionTarget, object item)

{

    var paneGroup = regionTarget as RadPaneGroup;
    if (paneGroup == null) return null;
    var pane = paneGroup.IsInDocumentHost ? new RadDocumentPane() : new RadPane();

    
    pane.Content = item;

    pane.DataContextGetDataContext(item);
    
    // ISSUE: Setting these bindings here fixes a data binding issue in the Telerik RadPane control.
    SetPaneBindings(pane);
     
    return
pane;

}

/// <summary>

/// ISSUE: Setting these bindings here fixes a data binding issue in the Telerik RadPane control.
/// In several scenarios, such as making a RadPane float, the RadPane will lose the data binding
/// assigned to it when binding in Xaml. There are few solutions and none that are satisfactory
/// so setting the bindings here will do as well as the others. For this solution to workaround
/// the issue, the datacontext object needs to implement properties matching the bindings being
/// set to the RadPane. This is not ideal but until Telerik fixes their control we have to deal
/// with it.
///
/// Here is one of the forum posts discussing the issue with a different solution:
/// http://www.telerik.com/community/forums/wpf/docking/databinding-broken-on-radpane-selection-change.aspx
/// </summary>
private static void SetPaneBindings(RadPane pane)

{
    var titleBinding = new Binding(RadPane.TitleProperty.Name)

    {

        Source = pane.DataContext,
        FallbackValue = string.Empty,
        TargetNullValue = string.Empty

    };

    pane.SetBinding(RadPane.TitleProperty, titleBinding);

    
    var
canUserCloseBinding = new Binding(RadPane.CanUserCloseProperty.Name)

    {

        Source = pane.DataContext,

        FallbackValue = true,

        TargetNullValue = true

    };

    pane.SetBinding(RadPane.CanUserCloseProperty, canUserCloseBinding);

    
    var
canFloatBinding = new Binding(RadPane.CanFloatProperty.Name)

    {

        Source = pane.DataContext
        FallbackValue = true
        TargetNullValue = true

    };

    pane.SetBinding(RadPane.CanFloatProperty, canFloatBinding);

}


private
static object GetDataContext(object item)

{

    var fe = item as FrameworkElement
    return fe != null ? fe.DataContext : item;

}


For more context, here is the Xaml which contains the Telerik Docking control layout:

<UserControl x:Class="MyApp.View.LayoutView"

            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

            xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism" 
            xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
            xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"

            xmlns:telerikChromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls"

            xmlns:Core="clr-namespace:MyApp.Core;assembly=MyApp.Core" 
    mc:Ignorable="d" 
    d:DesignHeight="100"

    d:DesignWidth="100">


    <
UserControl.Resources
        <!-- PaneHeader DataTemplate with close button --> 
        <DataTemplate x:Key="PaneHeaderDataTemplate"> 
            <DataTemplate.Resources
                <Style x:Key="PaneHeaderCloseButtonStyle" TargetType="{x:Type telerikControls:RadButton}"> 
                    <Style.Resources
                        <telerikControls:Office_BlackTheme x:Key="Theme"/> 
                        <SolidColorBrush x:Key="ButtonIconBrush_Normal" Color="#FF696969"/> 
                        <SolidColorBrush x:Key="ButtonIconBrush_MouseOver" Color="#FF000000"/> 
                        <SolidColorBrush x:Key="ButtonIconBrush_Pressed" Color="#FF000000"/> 
                        <SolidColorBrush x:Key="ButtonIconBrush_Disabled" Color="#FF8D8D8D"/> 
                        <Style x:Key="CloseIconStyle" TargetType="{x:Type Path}"> 
                            <Setter Property="Data" Value="M0,0 L2,0 2,1 3,1 3,2 5,2 5,1 6,1 6,0 8,0 8,1 7,1 7,2 6,2 6,3 5,3 5,4 6,4 6,5 6,5 7,5 7,6 8,6 8,7 6,7 6,6 5,6 5,5 3,5 3,6 2,6 2,7 0,7 0,6 1,6 1,5 2,5 2,4 3,4 3,3 2,3 2,2 1,2 1,1 0,1 Z"/> 
                            <Setter Property="Stretch" Value="Fill"/> 
                            <Setter Property="VerticalAlignment" Value="Center"/> 
                            <Setter Property="HorizontalAlignment" Value="Center"/> 
                        </Style
                    </Style.Resources
                    <Setter Property="ToolTip" Value="Close"/> 
                    <Setter Property="Width" Value="15"/> 
                    <Setter Property="Height" Value="15"/> 
                    <Setter Property="IsTabStop" Value="False" /> 
                    <Setter Property="SnapsToDevicePixels" Value="True"/> 
                    <Setter Property="Template"> 
                        <Setter.Value
                            <ControlTemplate TargetType="telerikControls:RadButton"> 
                                <Grid x:Name="LayoutRoot"> 
                                    <telerikChromes:ButtonChrome telerikControls:StyleManager.Theme="{StaticResource Theme}" RenderNormal="False" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}"/> 
                                    <Path x:Name="Icon" Fill="{StaticResource ButtonIconBrush_Normal}" Margin="4,4,4,4" Style="{StaticResource CloseIconStyle}"/> 
                                </Grid
                                <ControlTemplate.Triggers
                                    <Trigger Property="IsMouseOver" Value="True"> 
                                        <Setter TargetName="Icon" Property="Fill" Value="{StaticResource ButtonIconBrush_MouseOver}"/> 
                                    </Trigger
                                    <Trigger Property="IsPressed" Value="True"> 
                                        <Setter TargetName="Icon" Property="Fill" Value="{StaticResource ButtonIconBrush_Pressed}"/> 
                                    </Trigger
                                    <Trigger Property="IsEnabled" Value="False"> 
                                        <Setter TargetName="Icon" Property="Fill" Value="{StaticResource ButtonIconBrush_Disabled}"/> 
                                    </Trigger
                                </ControlTemplate.Triggers
                            </ControlTemplate
                        </Setter.Value
                    </Setter
                </Style
            </DataTemplate.Resources            
            <
Grid Background="#00000000"> 
                <Grid.ColumnDefinitions
                    <ColumnDefinition Width="*"/> 
                    <ColumnDefinition Width="Auto"/> 
                </Grid.ColumnDefinitions
                <TextBlock Text="{Binding}" 
                            VerticalAlignment="Center" 
                            TextTrimming="CharacterEllipsis" 
                            TextWrapping="NoWrap
                            Height="{Binding ElementName=CloseButton, Path=ActualHeight, Mode=OneWay}"/> 
                
                <
telerikControls:RadButton x:Name="CloseButton
                            Style="{StaticResource PaneHeaderCloseButtonStyle}" 
                            Command="telerikDocking:RadDockingCommands.Close
                            CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=telerikDocking:RadPane}, Mode=OneWay}" 
                            Visibility="Hidden
                            Margin="5,0,0,0" 
                            Grid.Column="1"/> 
            </Grid
            <DataTemplate.Triggers
                <DataTrigger Binding="{Binding Path=CanUserClose, RelativeSource={RelativeSource AncestorType=telerikDocking:RadPane}, Mode=OneWay}" Value="false"> 
                    <Setter Property="Visibility" Value="Collapsed" TargetName="CloseButton"/> 
                </DataTrigger
                <MultiDataTrigger
                    <MultiDataTrigger.Conditions
                        <Condition Binding="{Binding Path=CanUserClose, RelativeSource={RelativeSource AncestorType=telerikDocking:RadPane}, Mode=OneWay}" Value="true"/> 
                        <Condition Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType=telerikDocking:RadPane}, Mode=OneWay}" Value="true"/> 
                    </MultiDataTrigger.Conditions
                    <Setter Property="Visibility" Value="Visible" TargetName="CloseButton"/> 
                </MultiDataTrigger
                <MultiDataTrigger
                    <MultiDataTrigger.Conditions
                        <Condition Binding="{Binding Path=CanUserClose, RelativeSource={RelativeSource AncestorType=telerikDocking:RadPane}, Mode=OneWay}" Value="true"/> 
                        <Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}, Mode=OneWay}" Value="true"/> 
                    </MultiDataTrigger.Conditions
                    <Setter Property="Visibility" Value="Visible" TargetName="CloseButton"/> 
                </MultiDataTrigger
            </DataTemplate.Triggers
        </DataTemplate
        
        <
Style x:Key="PaneStyle" TargetType="{x:Type telerikDocking:RadPane}"> 
            <!--

            ISSUE: Setting these bindings here will not work because of a data binding issue in the Telerik RadPane control.

            The bindings work when they are initially bind but get broken if the RadPane is made to float (among other

            state changes). To workaround this issue the bindings are set in the DockingRegionAdapter as the items

            are created and added to each RadPaneGroup in the Docking control regions.

 

            Here is one of the forum posts discussing the issue with a different solution:

            http://www.telerik.com/community/forums/wpf/docking/databinding-broken-on-radpane-selection-change.aspx

            -->

 

            <!--

            <Setter Property="Title" Value="{Binding Path=Title}"/>

            <Setter Property="CanFloat" Value="{Binding Path=CanFloat}"/>

            <Setter Property="CanUserClose" Value="{Binding Path=CanUserClose}"/>

            -->

            <Setter Property="HeaderTemplate" Value="{StaticResource PaneHeaderDataTemplate}"/> 
            <Setter Property="ContextMenuTemplate" Value="{x:Null}"/> 
        </Style
        
        <!-- Default styles applied to all panes and document panes --> 
        <Style TargetType="{x:Type telerikDocking:RadDocumentPane}" BasedOn="{StaticResource PaneStyle}"/> 
        <Style TargetType="{x:Type telerikDocking:RadPane}" BasedOn="{StaticResource PaneStyle}"/> 
    </UserControl.Resources>

 
    <telerikDocking:RadDocking HasDocumentHost="true">

        <telerikDocking:RadDocking.DocumentHost
            <telerikDocking:RadSplitContainer InitialPosition="DockedTop"> 
                <telerikDocking:RadPaneGroup prism:RegionManager.RegionName="{x:Static Core:LayoutRegionNames.Document}"/> 
            </telerikDocking:RadSplitContainer
        </telerikDocking:RadDocking.DocumentHost
        
        <
telerikDocking:RadSplitContainer InitialPosition="DockedLeft"> 
            <telerikDocking:RadPaneGroup prism:RegionManager.RegionName="{x:Static Core:LayoutRegionNames.Left}"/> 
        </telerikDocking:RadSplitContainer
           
        <
telerikDocking:RadSplitContainer InitialPosition="DockedRight"> 
            <telerikDocking:RadPaneGroup prism:RegionManager.RegionName="{x:Static Core:LayoutRegionNames.Right}"/> 
        </telerikDocking:RadSplitContainer

        <telerikDocking:RadSplitContainer InitialPosition="DockedBottom"> 
            <telerikDocking:RadPaneGroup prism:RegionManager.RegionName="{x:Static Core:LayoutRegionNames.Bottom}"/> 
        </telerikDocking:RadSplitContainer
    </telerikDocking:RadDocking>

</UserControl>

 


I don't know if anyone is watching this thread anymore but if they are I hope this is useful.

Edit: Tried to fix code format that got jacked up when it posted.
0
Miroslav Nedyalkov
Telerik team
answered on 06 Feb 2012, 09:02 AM
Hello Everybody,

Setting the PropagateItemDataContextToContent property of the PaneGroup to true will prevent breaking of the bindings. The problem you are observing is connected to the fact that the Content of the item is displayed inside the Group.

We are not aware of a problem, connected with the bindings themselves and it would be very helpful if you could share an example that demonstrates this matter.

All the best,
Miroslav Nedyalkov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Thomas
Top achievements
Rank 1
answered on 07 Feb 2012, 03:49 AM
Hi Miroslav,

Thanks for replying to this thread. I have a complete solution that can be exercised to show the behavior. The solution is a test project that I use to develop and test against the docking control so it has a bunch of extra stuff but it was easiest to just send the solution with ripping out as little as possible. The solution is WPF MVVM application and uses Prism and MEF. It allows for testing in a more realistic solution in any case. That being said I need a way to send you the solution zip file since I cannot add it to the thread here.

To test the issue I mentioned you only need to be aware of the DockingRegionAdapter.cs and DockingView.xaml files. The issue occurs when dragging region views into the document region and then dragging them back out. Doing the same thing to any other region does not cause the issue. I have comments in both of the files mentioned detailing how to reproduce the issue. Only one line in each file needs to be modified (commented/uncommented) to see the behavior.

Let me know if you need more clarification.

On a side note, I looked into the PropagateItemDataContextToContent property. The default value of this property is true so it could not be the issue in this case. I tried setting it just in case the documentation was incorrect as to the default value.

Thanks
0
Miroslav Nedyalkov
Telerik team
answered on 07 Feb 2012, 12:21 PM
Hi Thomas,

You cannot send files in forum threads - to send us the solution you prepared you need to open a support thread and attach the file in it. It will be much easier for us if you could send us the test solution you are using.

Kind regards,
Miroslav Nedyalkov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Thomas
Top achievements
Rank 1
answered on 07 Feb 2012, 07:03 PM
Hi Miroslav,

I've opened a PIT for this issue because I don't seem to have the support subscription allowing me to open a support thread as you suggested. Can you advise me as to the best course of action to take? By not being able to send the solution it really makes this much more difficult and time consuming for anyone to test and determine the issue and possible solution.

Thanks.
0
Yana
Telerik team
answered on 10 Feb 2012, 10:32 AM
Hello Thomas,

Please check your account - we've created a private support thread, so you can attach the project there without a problem.

All the best,
Yana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Thomas
Top achievements
Rank 1
answered on 10 Feb 2012, 05:31 PM
Hi Yana,

Thank you for helping with this issue. I was able to open a support thread with detailed information and the project. Your team got back to me late yesterday stating that they are not able to determine the cause of the issue but are investigating it further.

Here is what they said:

"We investigated this, but we were not able to find the source of the issue. We will need some additional time to resolve it. Currently we are preparing for the next major version of RadControls for WPF - 2012 Q1 and we will not be able to pay attention to this issue until we are done. We will be able to investigate this further next week after the release is out.

Hopefully they will find a solution for the issue.

Thanks,
Tom
0
Yana
Telerik team
answered on 10 Feb 2012, 05:37 PM
Hi Thomas,

That is right, thank you for your understanding.

Kind regards,
Yana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Tessa
Top achievements
Rank 1
answered on 26 Mar 2014, 10:27 AM
Thomas - did you ever get a reply/solution for your issue described above?
0
YYZRichard
Top achievements
Rank 2
answered on 26 Mar 2014, 11:10 AM
It was so long ago, I am not even support that application anymore, so I'm not sure if there's a solution for the problem. Good luck.
0
Thomas
Top achievements
Rank 1
answered on 26 Mar 2014, 06:14 PM
Hi Tessa,

The project is still using the solution I posted some time ago with only slight modifications. What I did find I could do, to make binding easier to manage using styles, was to set the RadPane/RadDocumentPane style in the region adaptor instead of fixing individual bindings.

Here is the updated method that does the work:

private static void SetPaneStyle(RadPaneGroup paneGroup, RadPane pane)
{
    var docking = paneGroup.ParentOfType<RadDocking>();
    if (docking == null)
    {
        return;
    }
 
    var paneStyle = docking.TryFindResource(paneGroup.IsInDocumentHost ? typeof(RadDocumentPane) : typeof(RadPane)) as Style;
    if (paneStyle != null)
    {
        pane.Style = paneStyle;
    }
}

Here is some sample Xaml defining the styles:

<Style x:Key="PaneStyle" TargetType="{x:Type telerikDocking:RadPane}">
    <Setter Property="Title" Value="{Binding Path=Title}"/>
    <Setter Property="CanFloat" Value="{Binding Path=CanFloat}"/>
    <Setter Property="CanUserClose" Value="{Binding Path=CanUserClose}"/>
    <Setter Property="HeaderTemplate" Value="{StaticResource PaneHeaderDataTemplate}"/>
    <Setter Property="ContextMenuTemplate" Value="{x:Null}"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerikDocking:RadPane}">
                <ScrollViewer Padding="{TemplateBinding Padding}">
                    <ContentPresenter />
                </ScrollViewer>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
 
<!-- Default styles applied to all panes and document panes -->
<Style TargetType="{x:Type telerikDocking:RadDocumentPane}" BasedOn="{StaticResource PaneStyle}"/>
<Style TargetType="{x:Type telerikDocking:RadPane}" BasedOn="{StaticResource PaneStyle}"/>


Hope this helps.

Tom
0
Tessa
Top achievements
Rank 1
answered on 27 Mar 2014, 02:25 PM
Thanks very much for the responses - I will give the above a go. 

0
Dietmar
Top achievements
Rank 1
answered on 23 Jul 2015, 09:51 AM

Hi Thomas,

thank you very much for your shared code and information. It helps me today in current Telerik UI for WPF V2015-Q2.

Thank you

Dietmar

 

Tags
Docking
Asked by
Aaron
Top achievements
Rank 1
Answers by
Philip
Top achievements
Rank 1
Aaron
Top achievements
Rank 1
YYZRichard
Top achievements
Rank 2
Thomas
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Yana
Telerik team
Tessa
Top achievements
Rank 1
Dietmar
Top achievements
Rank 1
Share this question
or