Cannot get extra datagrid to work

May 17, 2014 at 12:08 PM
Hello Rehan
thanks for this nice library. I saw the intro video on the home page and was really impressed with the elastic picket...that is something i would want to include in my apps definitely so i thought i would get started with the data-grid but having some build issues.

Here is my xaml:

<metro:Window
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:Custom="http://schemas.extra.com/ui"
   xmlns:metro="http://schemas.codeplex.com/elysium"
   xmlns:params="http://schemas.codeplex.com/elysium/params"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   Width="992"
   Height="674"
   Foreground="#FFF9F7F7"
   params:Design.Theme="Light"
   Title="MainWindow">
   <DockPanel
      x:Name="DockPanel_MainWindow"
      Margin="0,0,2,0"
      Background="White"
      ScrollViewer.HorizontalScrollBarVisibility="Auto"
      ScrollViewer.VerticalScrollBarVisibility="Auto">
      <DataGrid
         x:Name="ServiceGrid"
         HorizontalAlignment="Stretch"
         Margin="5,-473,5,76"
         VerticalAlignment="Stretch"
         AutoGenerateColumns="false"
         DockPanel.Dock="Left"
         HorizontalContentAlignment="Stretch"
         IsReadOnly="True"
         RenderTransformOrigin="0.499,-2.325"
         VerticalContentAlignment="Stretch">
         <DataGrid.Columns>
            <Custom:DataGridTextColumn Binding="{Binding Server}" Header="Server"/>
            <DataGridTextColumn Binding="{Binding Name}" Header="Name"/>
            <DataGridTextColumn Binding="{Binding DisplayName}" Header="DisplayName"/>
            <DataGridTextColumn Binding="{Binding Status}" Header="Status"/>
            <DataGridTextColumn Binding="{Binding StartMode}" Header="StartMode"/>
            <DataGridTextColumn Binding="{Binding Account}" Header="Account"/>
         </DataGrid.Columns>
      </DataGrid>
   </DockPanel>
</metro:Window>
if i dont include the custom:datagridtextcolumn in the xaml i can get it to work but that gives me the default wpf datagrid which i do not want.

these are the errors i get when i try to build with the 'extra' datagrid:

XamlParseExceptionOccured
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information: 'The invocation of the constructor on type 'Framework.UI.Controls.DataGridTextColumn' that matches the specified binding constraints threw an exception.' Line number '94' and line position '18'.



Error   2   Invalid token '>' in class, struct, or interface member declaration C:\kiran\temp\WpfXamlLoader.cs  20  42  
Error   3   Method must have a return type  C:\Users\kiran\temp\WpfXamlLoader.cs    20  43  


Warning 4   Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. 
Warning 5   Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. 


Coordinator
May 25, 2014 at 1:59 PM
Hi,

Yes the solution is simple. Do not use the WPF DataGridTextColumn. Use the extra:DataGridTextColumn where extra is the Elysium extra namespace.

This is done to style the columns correctly.

Hope that helps.
May 26, 2014 at 5:48 PM
thanks for the reply Rehan.

I was actually using the extra namespace just that i had named it as "controls" anyway i have renamed it as "extra" as you suggested and have simplified the xaml. But everytime i get this error:
{"'DataGridTextColumnEditingElementStyle' resource not found."}
Am i missing a resource in the resource dictionary?
<metro:Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:metro="http://schemas.codeplex.com/elysium" 
        xmlns:extra="http://schemas.extra.com/ui" 
        xmlns:params="http://schemas.codeplex.com/elysium/params"
        params:Design.Theme="Dark"
        Title="MainWindow" Height="674" Width="992" Foreground="#FFF9F7F7"
    >

    <metro:Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>      
                <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Controls/Datagrid.xaml"/>
                <ResourceDictionary Source="/Framework.UI;component/Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </metro:Window.Resources>

    <DockPanel x:Name="DockPanel_MainWindow" Margin="0,0,2,0"  Background="White"  >
        <DataGrid x:Name="ServiceGrid" DockPanel.Dock="Left"  Margin="15,73,15,67" >
            
            <DataGrid.Columns>
                    <extra:DataGridTextColumn Header="Hello"/>
                    <extra:DataGridTextColumn Header="world" />
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</metro:Window>
Coordinator
May 27, 2014 at 11:20 AM
Edited May 27, 2014 at 11:29 AM
Hi,

Add the following to your App.xaml file:
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>      
                <ResourceDictionary Source="/Framework.UI;component/Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
You don't need to add anything to the Window resources at all.
Coordinator
May 27, 2014 at 11:33 AM
I've updated the Documentation tab with a Getting Started section.
May 27, 2014 at 3:38 PM
thanks :)
May 27, 2014 at 4:09 PM
yup getting started section helped......for the first time the program ran and showed me an ui lol...
Coordinator
May 30, 2014 at 3:33 PM
Edited May 30, 2014 at 3:44 PM
Excellent!! If you like the framework, please rate it on the front page.