locked
DATA GRID QUESTION.... RRS feed

  • Question

  • Hi, i will like someone to explain me how to use data grid in Microsoft Expression Blend 4.0 + Scketchflow because when i try to use it but it genetare me errors...

     

    Thank You so much.


    Maria Eugenia Marroquin R.
    Thursday, February 3, 2011 4:09 PM

All replies

  • Could you provide more details? What errors? What are you trying to do? What does the xaml look like?
    Thursday, February 3, 2011 5:23 PM
    Moderator
  • ERROR 1

    <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    x:Class="DATAGRIDScreens.Screen_3"
    Width="640" Height="480" mc:Ignorable="d">
    <UserControl.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="ProjectDataSources.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource TEST2}}">
    <TextBox Margin="140,19,143,0" Style="{StaticResource BasicTextBox-Sketch}" TextWrapping="Wrap" Text="&#xa;        DATA GRID ERROR 2" FontWeight="Bold" FontSize="29.333" BorderBrush="#FFFF3103" Foreground="#FF0E4FD0" Height="118" VerticalAlignment="Top"/>
    <sdk:DataGrid Margin="140,189,143,166" DataContext="{Binding Source={StaticResource Test1}}" AutoGenerateColumns="False" ItemsSource="{Binding Collection}">
    <sdk:DataGrid.Columns>
    <sdk:DataGridTextColumn Binding="{Binding Test_1}" Header="Test_1"/>
    <sdk:DataGridTemplateColumn CanUserSort="True" CanUserReorder="True" CellStyle="{x:Null}" CanUserResize="True" CellEditingTemplate="{x:Null}" ClipboardContentBinding="{x:Null}" CellTemplate="{x:Null}" DisplayIndex="-1" DragIndicatorStyle="{x:Null}" HeaderStyle="{x:Null}" Header="NewColumn" IsReadOnly="False" MaxWidth="Infinity" MinWidth="0" SortMemberPath="{x:Null}" Visibility="Visible" Width="Auto"/>
    <sdk:DataGridTextColumn Binding="{x:Null}" CanUserSort="True" CanUserReorder="True" CellStyle="{x:Null}" CanUserResize="True" ClipboardContentBinding="{x:Null}" DisplayIndex="-1" DragIndicatorStyle="{x:Null}" EditingElementStyle="{x:Null}" ElementStyle="{x:Null}" Foreground="{x:Null}" FontWeight="Normal" FontStyle="Normal" FontSize="NaN" HeaderStyle="{x:Null}" Header="{x:Null}" IsReadOnly="False" MaxWidth="Infinity" MinWidth="0" SortMemberPath="{x:Null}" Visibility="Visible" Width="Auto"/>
    <sdk:DataGridTextColumn Binding="{Binding Test_2}" Header="Test_2"/>
    <sdk:DataGridTextColumn Binding="{Binding Test_3}" Header="Test_3"/>
    <sdk:DataGridTextColumn Binding="{Binding Test_4}" Header="Test_4"/>
    </sdk:DataGrid.Columns>
    </sdk:DataGrid>
    </Grid>
    </UserControl>


    QUESTION 2 - iN hERE how can i add data when i add a new template column... Thanks a LOT!

    <UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    mc:Ignorable="d"
    x:Class="DATAGRIDScreens.Screen_2"
    Width="640" Height="480">
    <UserControl.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="ProjectDataSources.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource TEST2}}">
    <TextBox Margin="140,19,143,0" Style="{StaticResource BasicTextBox-Sketch}" TextWrapping="Wrap" Text="&#xa;        DATA GRID ERROR 1" FontWeight="Bold" FontSize="29.333" BorderBrush="#FFFF3103" Foreground="#FF0E4FD0" Height="118" VerticalAlignment="Top"/>
    <sdk:DataGrid Margin="8,165,24,179" DataContext="{Binding}" AutoGenerateColumns="False" ItemsSource="{Binding Collection}" HorizontalGridLinesBrush="#FF51C0C0" Clip="{Binding Collection[0].Prueba1, Source={StaticResource SIMPLEDATA1}}" Cursor="{Binding Collection[0].Test1, FallbackValue=Prueba Template}">
    <sdk:DataGrid.BorderBrush>
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFA3AEB9" Offset="0"/>
    <GradientStop Color="#FF8399A9" Offset="0.375"/>
    <GradientStop Color="#FF718597" Offset="0.375"/>
    <GradientStop Color="#FF4579A1" Offset="1"/>
    </LinearGradientBrush>
    </sdk:DataGrid.BorderBrush>
    <sdk:DataGrid.Columns>
    <sdk:DataGridTemplateColumn Header="TESTTEMPLATE0"/>
    <sdk:DataGridTextColumn Binding="{Binding Test2}" Header="Header 3" DisplayIndex="2"/>
    <sdk:DataGridTextColumn Binding="{Binding Test1}" Header="CheCKbox1" DisplayIndex="3"/>
    <sdk:DataGridCheckBoxColumn Binding="{x:Null}" CanUserSort="True" CanUserReorder="True" CellStyle="{x:Null}" CanUserResize="True" ClipboardContentBinding="{x:Null}" DisplayIndex="4" DragIndicatorStyle="{x:Null}" EditingElementStyle="{x:Null}" ElementStyle="{x:Null}" HeaderStyle="{x:Null}" Header="Chechbox1.1" IsThreeState="False" IsReadOnly="False" MaxWidth="Infinity" MinWidth="0" SortMemberPath="{x:Null}" Visibility="Visible" Width="Auto"/>
    <sdk:DataGridTextColumn Binding="{Binding Test3}" Header="Header5"/>
    </sdk:DataGrid.Columns>
    </sdk:DataGrid>
    </Grid>
    </UserControl>


    THANKS MI BIG QUESTION, jejeje, THANKS A LOT CHUCK!:)

    Maria Eugenia Marroquin R.
    Thursday, February 3, 2011 6:20 PM
  • For ERROR 1, you don't mention what the error is.

     

    For question 2, you can add new values to the sample data in the data panel. You can add new columns in the objects and timeline panel by right clicking the datagrid. You can databind the column to a value from the sample data by selecting the column and using the properties panel UI to bind it.

    Thursday, February 3, 2011 6:25 PM
    Moderator
  • Sorry in ERROR 1 says: An Expeption whas thrown, Stacktrace - InnerExeption: None

     

    Thanks again.


    Maria Eugenia Marroquin R.
    Thursday, February 3, 2011 6:32 PM