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

how c1 DataGrid can be called in xaml

rated by 0 users
This post has 3 Replies | 3 Followers

Not Ranked
Posts 1
krajiv23 Posted: Mon, Nov 24 2008 5:14 AM

 I am new to Silverlight and have to create a silverelight application in IronPython.

any body please tell me how i can use C1 datagrid in xaml.

       or

 

any other way of example please to do this

Top 10 Contributor
Posts 2,707

Creating a C1DataGrid in XAML is just like creating any other control (and does not depend on the language you're using AFAIK).

Here's a sample. Notice the "xmlns" statement that brings the DataGrid assembly into the context of the page.

<UserControl x:Class="JustAGrid.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c1_data="clr-namespace:C1.Silverlight.DataGrid;assembly=C1.Silverlight.DataGrid"
    Width="800" Height="600">
    <Grid x:Name="LayoutRoot" Background="White">
        <c1_data:C1DataGrid x:Name="_grid" AutoGenerateColumns="True" />
    </Grid>
</UserControl>

I hope this helps.

Not Ranked
Posts 6
antony.02y replied on Mon, Nov 24 2008 11:26 PM


Thank's to your quick reply, but this is not working for me.I am getting the following error.

SystemError:

The tag 'C1DataGrid' does not exist in XML namespace 'clr-namespace:C1.Silverlight.DataGrid;assembly=C1.Silverlight.DataGrid'. 

I am sending  the full code (in XAML) which i am writing at notepad calling in Ironpython code 

 

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c1_data="clr-namespace:C1.Silverlight.DataGrid;assembly=C1.Silverlight.DataGrid"
    Title="Student Details" Height="250" Width="400" >
   
    <Grid  Height="215" Width="350" >
        <Grid.Background>
            <LinearGradientBrush>
                <LinearGradientBrush.GradientStops>
                    <GradientStopCollection>
                        <GradientStop Color="BlanchedAlmond" Offset="0" />
                        <GradientStop Color="Chocolate" Offset="0.25"/>
                        <GradientStop Color="Azure" Offset="0.5"/>
                        <GradientStop Color="Azure" Offset="1"/>
                    </GradientStopCollection>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
        </Grid.Background>
            <Grid.RowDefinitions>
            <RowDefinition Height="35" ></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition ></ColumnDefinition>
            <ColumnDefinition ></ColumnDefinition>
          
        </Grid.ColumnDefinitions>
       
        <TextBlock Name="lblstdid" Text="Student ID" FontWeight="Bold" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"></TextBlock>
        <TextBlock Name="lblstdname" Text="Student Name" FontWeight="Bold" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" ></TextBlock>
        <TextBlock Name="lblscountry" Text="Country" FontWeight="Bold" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center"></TextBlock>
        <TextBox Name="txtstdid" Grid.Row="0" Grid.Column="1" Margin="5.831,5,12,5" Grid.ColumnSpan="2"></TextBox>
        <TextBox Name="txtstdname" Grid.Row="1" Grid.Column="1" Margin="5.831,5,12,5" Grid.ColumnSpan="2"></TextBox>
        <TextBox Name="txtcountry" Grid.Row="2" Grid.Column="1" Margin="5.831,5,12,5" Grid.ColumnSpan="2"></TextBox>
        <Button Name="btnAdd" Grid.Row="3" Grid.Column="1" Margin="77,4,20,5" FontSize="14" FontWeight="Bold" >
           <Button.Background>
                <LinearGradientBrush>
                    <LinearGradientBrush.GradientStops>
                        <GradientStopCollection>
                            <GradientStop Color="Brown" Offset="0" />
                            <GradientStop Color="Gray" Offset="0.25"/>
                            <GradientStop Color="Chocolate" Offset="0.5"/>
                            <GradientStop Color="White" Offset="1"/>
                        </GradientStopCollection>
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Button.Background>
            ADD
        </Button>
          <c1_data:C1DataGrid x:Name="_grid" AutoGenerateColumns="True" Grid.Row="3" Grid.Column="0" />
       </Grid>
    </Window>
Top 10 Contributor
Posts 2,707

Did you add a reference to the C1.Silverlight.DataGrid assembly to your project?

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