Welcome to Geeks Portal Sign in | Join | Help | Sign In Live ID
in
 
 

MAYA'S weB LOGS

September 2009 - Posts

  • Silverlight 2.0 Parts and State VisualStateManager in details+sample code

    Four type high level things in Parts and States model are State, Parts, Transitions and State Group.

    For details explanation on that , there is a nice blog here written to explain VSM.

    Its a 4 pages step by step that explains the whole concepts and sample code for VSM. I like!

     

    Share this post: | | | |
  • Some random Silverlight 2.0 FAQ

    Today FAQ sections from Silverlight 2.0 in my class conducted in Microsoft Singapore :


    1.How to repeat video in Silverlight 2.0 in C# code?


    in page.xaml:
    <MediaElement x:Name="PapiChanVideo"
                              Margin="19,0,0,82"
                              VerticalAlignment="Bottom"
                              Source="Video/14FtWavesMexico.wmv" MediaEnded="PapiChanVideo_MediaEnded"
                              Stretch="Fill"
                              HorizontalAlignment="Left"
                              Height="146"
                              Width="238"/>


    and the next step under C#
      private void PapiChanVideo_MediaEnded(object sender, RoutedEventArgs e)
            {
                PapiChanVideo.Stop();
                PapiChanVideo.Play();
            }

     

    2. Is it possible to generate a Style in App.xaml without mentioning TargetType?
    No.


    3. What is the meaning of star in width="5*" or width="10*" while you define a rowdefinition?
    This means that this is a relative value to the total height or width of the Grid that these belong to.
    So if you have two rows and the first row has a height of 5* and the second row has a height of 10*,
    then the Grid will try and keep the second row at twice the height of the first row, based on the available space
    and the space requested by the controls in the rows.
    If I would change the second row to 5* then the Grid will try to keep the rows at the same height.


    4. How do we remove the column filler in a datagrid if we only have 2data columns but it looks like there are 3 columns generated?
    So this is actually a column filler, because while you define a grid in absolute numbers it will generate a filler(so it will looks like 3
    column eventhough you have only 2 columns).This sample code will generate column filler:

    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Horse Race Results" />
                        <myData:DataGrid x:Name="dgRaces"
                                         AutoGenerateColumns="False"
                                         Height="140"
                                         Width="220"
                                         BorderThickness="0">
                            <!-- DataGrid Column definitions go here -->
                            <myData:DataGrid.Columns>
                                <myData:DataGridTextColumn Binding="{Binding Place}" Header="Place" />
                                <myData:DataGridTextColumn Binding="{Binding HorseName}" Header="HorseName" />
                            </myData:DataGrid.Columns>
                        </myData:DataGrid>
                    </StackPanel>

    because in a data call Place and HorseName , we dont define the absolute number based on grid, so the next code will resolve the issue

           <StackPanel Orientation="Vertical">
                        <TextBlock Text="Horse Race Results" />
                        <myData:DataGrid x:Name="dgRaces"
                                         AutoGenerateColumns="False"
                                         Height="140"
                                         Width="220"
                                         BorderThickness="0">
                            <!-- DataGrid Column definitions go here -->
                            <myData:DataGrid.Columns>
                                <myData:DataGridTextColumn Binding="{Binding Place}" Header="Place" Width="100"  />
                                <myData:DataGridTextColumn Binding="{Binding HorseName}" Header="HorseName" Width="120"/>
                            </myData:DataGrid.Columns>
                        </myData:DataGrid>
                       
                    </StackPanel>


    (so we only need to add the absolute width in our data binding to make sure there are no filler for in the blank area of the grid)

     

     


     

    Share this post: | | | |
 
 
Powered by Community Server (Commercial Edition), by Telligent Systems
Copyright © INDC, 2006. All rights reserved.