C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Docking Windows and DataGrids

rated by 0 users
This post has 10 Replies | 1 Follower

Top 75 Contributor
Posts 71
zardozwildman Posted: Thu, Jan 14 2010 5:29 PM

Our prototype application was originally one DataGrid displayed within the application.

I've been converting the application to use docking windows. The idea is to display multiple docking views. Each one contains a DataGrid.

I've run into several problems with the docking views.

1) If the C1DockTabItem contains a DataGrid, I get the following exception:

Value does not fall within specified range.

This happens anytime I resize the application window. Also when dragging dock view around.

 2) At one point, I tried altering my XAML so that the DataGrid was a child of a StackPanel. Silverlight seems to hate this. If I alter the XAML in that manner, then the DataGrid renders very slowly. This XAML change does not prevent the exceptions from occurring.

 

Here is my current XAML for the docking view:

 <c1Docking:C1DockTabControl x:Class="ReportViewer.View.DataSetDockTab"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c1grid="clr-namespace:C1.Silverlight.DataGrid;assembly=C1.Silverlight.DataGrid"
    xmlns:c1Docking="clr-namespace:C1.Silverlight.Docking;assembly=C1.Silverlight.Docking"
    DockMode="Docked" TabItemShape="Sloped" TabItemClose="GlobalClose"
    TabItemClosed="DockTab_TabItemClosed" CanUserHide="False" Loaded="C1DockTabControl_Loaded">
    <c1Docking:C1DockTabItem Header="New Table">
        <Grid Background="Bisque">
            <Grid.RowDefinitions>
                <RowDefinition Height="48"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid Background="CadetBlue">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" x:Name="MasterGridReportTitle" FontSize="16" HorizontalAlignment="Center"/>
                <TextBlock Grid.Row="1" x:Name="MasterGridReportDateRange" FontSize="12" HorizontalAlignment="Center"/>
            </Grid>
            <c1grid:C1DataGrid Grid.Row="1" x:Name="C1MasterGrid"
                    CanUserGroup="True"
                    CanUserFreezeColumns="True"
                    CanUserAddRows="False"
                    CanUserEditRows="False"
                    CanUserFilter="True"
                    CanUserRemoveRows="False"
                    CanUserReorderColumns="True"
                    CanUserResizeColumns="True"
                    CanUserResizeRows="False"
                    CanUserSort="True"
                    CanUserToggleDetails="True"
                    AutoGeneratingColumn="C1MasterGrid_AutoGeneratingColumn"
                    ColumnsLoaded="C1MasterGrid_ColumnsLoaded"
                    CreatingRow="C1MasterGrid_CreatingRow"
                    LoadingRow="C1MasterGrid_LoadingRow"
                    GroupChanged="C1MasterGrid_GroupChanged"
                    LoadedRowDetailsPresenter="C1MasterGrid_LoadedRowDetailsPresenter"
                    AutoGenerateColumns="True"
                    FrozenColumnCount="0"
                    RecycleRows="True"
                    IsReadOnly="True"
                    HeadersVisibility="All"
                    RowHeaderWidth="15"
                    GridLinesVisibility="Vertical"
                    VerticalScrollBarVisibility="Visible"
                    HorizontalScrollBarVisibility="Auto"
                    VerticalGridLinesBrush="Aquamarine"
                    HorizontalGridLinesBrush="Aqua">
                <c1grid:C1DataGrid.RowDetailsTemplate>
                    <DataTemplate>
                        <c1grid:C1DataGrid x:Name="C1ChildGrid"
                            CanUserGroup="False"
                            CanUserFreezeColumns="False"
                            CanUserAddRows="False"
                            CanUserEditRows="False"
                            CanUserFilter="False"
                            CanUserRemoveRows="False"
                            CanUserReorderColumns="False"
                            CanUserResizeColumns="False"
                            CanUserResizeRows="False"
                            CanUserSort="False"
                            CanUserToggleDetails="False"
                            AutoGeneratingColumn="C1ChildGrid_AutoGeneratingColumn"
                            AutoGenerateColumns="True"
                            RecycleRows="True"
                            IsReadOnly="True"
                            HeadersVisibility="All"
                            RowHeaderWidth="15"
                            Margin="5"
                            SelectedIndex="-1">
                        </c1grid:C1DataGrid>
                    </DataTemplate>
                </c1grid:C1DataGrid.RowDetailsTemplate>
            </c1grid:C1DataGrid>
        </Grid>
    </c1Docking:C1DockTabItem>
</c1Docking:C1DockTabControl>

Brice Breeden Senior Software Engineer Impact Technologies briceb|at|impacttech.com
Top 50 Contributor
Posts 195
C1_BrunoM replied on Fri, Jan 15 2010 8:53 AM

Hi, Brice.

The problem is that you have a newer C1.Silverlight.dll that is incompatible with your older C1.Silverlight.Docking.dll.  Download a newer version of the later from http://helpcentral.componentone.com/cs/forums/p/81789/227203.aspx#227203 .  We deeply regret this state of affairs and are rethinking our release by forum strategy.

Regards,
Bruno

Top 75 Contributor
Posts 71

 
Hi Bruno,

Thanks for the update. I was worried I'd have to rearchitect into a
split pane and tab control model. I'll download the patch and give
it a try.

Have a few suggestions. Mentioned some before, and hope you can
pass them on.

I hope you guys keep the patches coming. This kind of customer
service is one of the reasons Impact purchased C1 products.
However, I know this takes more development effort and tracking.

I've noticed a few things:

1) When I enter the Silverlight forum, there is only one pinned thread.
"XapOptimizer also shrinks its price"
I don't know where I can see a list of bug fixes or patches.
If you know, please make a pinned thread that explains it.

2) When I posted this thread, you guys seemed to know where the
related thread was. But there is nothing to help the users find them.

3) I suggest making a few more pinned threads within the Silverlight
forum. Like one for "bug fixes" or "patches". Use it like
a cross-reference. If you have no internal bug tracking tool, it should
help you guys as well.

When you post a patch on a thread, post it on the original thread as
you currently do. Then make another post on the pinned thread. All you
have to say on the pinned thread is something like:

Patch (C1.Silverlight.dll)

and indicate the customer's thread.

Anytime a release occurs, those pinned threads are deleted. And you
create new ones.

Brice Breeden Senior Software Engineer Impact Technologies briceb|at|impacttech.com
Top 75 Contributor
Posts 71

I downloaded that patch. However, my only patch is currently just the C1.Silverlight.Data.dll patch.

That patch contains a fix for a DataSet issue.

I'll check other issues within the forum for additional patches.

Brice Breeden Senior Software Engineer Impact Technologies briceb|at|impacttech.com
Top 10 Contributor
Posts 1,261
C1_LeoV replied on Fri, Jan 15 2010 12:40 PM

Hi Brice,

Thanks again for your so valuable feedback.

We are updgrading the forum software as well, so I will try to put take this things into account too.

Regards

Follow me: Twitter.com/leovernazza/

Top 50 Contributor
Posts 195
C1_BrunoM replied on Fri, Jan 15 2010 12:59 PM

Brice,

Send me an email to brunom@componentone.com so I can send you the latest set of assemblies.

Regards,

Top 75 Contributor
Posts 71

 Thanks Bruno.....email sent from:

 

briceb|at|impacttech.com

Brice Breeden Senior Software Engineer Impact Technologies briceb|at|impacttech.com
Top 75 Contributor
Posts 71

I created a test app and I'm able to recreate the errors using it. Attaching to this thread. Use the slider to create new docking views.

I used this demo to reliably cause the exception:

  • Value does not fall within the expected range.

My earlier posts describe issues in more detail.

Here are some observations I'll mention using the test app:

  • Dragging by header works fine.
  • DataGrids fail to render in some cases.
  • Dragging by tab can result in infinite loops or exceptions
  • Headers do not indicate which dock view has focus
  • Please check your code for xaml name issues (duplicate Name or x:Name). This is known to cause such exceptions.

Brice Breeden Senior Software Engineer Impact Technologies briceb|at|impacttech.com
Top 50 Contributor
Posts 195
C1_BrunoM replied on Mon, Jan 18 2010 1:20 PM

Hi, Brice.

The root problem is that class DataSetDockTab is defined as a Xaml and code behind pair, which is only valid for UserControl. Silverlight gets mighty confused otherwise. Non-UserControl classes don't get assigned their own NameScope, so x:Name in the Xaml causes name collisions when several instances are used in the same parent scoped, as is the case here.  Remove the x:Name attribute from the grid (you will have to comment a couple of lines from the code behind as well, but these don't affect the crash) to confirm this is the cause of the exception.

Change DataSetDockTab to a UserControl, so that it only represents the content of a C1DockTabItem.  Then create the C1DockTabItem and the C1DockTabControl in code.  Use C1DockControl.DockTabControlStyle to customize TabStripPlacement, TabItemShape, etc.. Note that this was needed anyway since new C1DockTabControl are sometimes automatically created when the user customizes the docking layout.

Let's hope this obscure problem was also the cause of the problems with ContextMenu. Tell me if not.

Regards,
Bruno

Top 75 Contributor
Posts 71

Bruno,

I didn't know this type of XAML implementation caused problems. Changing to UserControls is a major improvement. Consider this thread resolved.

However, ContextMenu is still an issue. When I have time, I'll post something explaining the two issues I've found. Along with some demo code.

Regarding XAML, I got the idea from the C1 Quick Start guide, for the C1Window example.

<c1:C1Window x:Class="QuickStart.MyWindow"

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

  xmlns:c1="clr-namespace:C1.Silverlight;assembly=C1.Silverlight"

  Width="400" Height="300">

 

  <Grid x:Name="LayoutRoot" Background="White">

    <TextBlock Text="We can put any control inside the window" />

  </Grid>

</c1:C1Window>

 

Brice Breeden Senior Software Engineer Impact Technologies briceb|at|impacttech.com
Top 50 Contributor
Posts 195
C1_BrunoM replied on Tue, Jan 19 2010 6:45 AM

I think this works in WPF.  Silverlight has some ugly spots.

Thanks for bringing up the quickstart. We'll fix it.

Regards,
Bruno

Page 1 of 1 (11 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.