none
How to implement currency management in Silverlight without using mvvm?

    Question

  • I need to have similar functionality as BindingSource we use in windows forms. Suppose we have a data grid and text box both are bind with same data table. On the selection change of the data grid i would like to text box value to be changed.

    This is working in windows forms.. I need to implement same functionality in silver light.

    <Grid Style="{StaticResource GridStyle}" HorizontalAlignment="Stretch" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
    
                </Grid.RowDefinitions>
    
                <Grid Grid.Row="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
    
    
                    <c1grid:C1DataGrid x:FieldModifier="Public" HorizontalScrollBarVisibility="Auto" Grid.Row="1" x:Name="gridTest" Style="{StaticResource DataGridStyle}" 
                                    MouseRightButtonUp="gridTest_MouseRightButtonUp" 
                                       MouseRightButtonDown="gridTest_MouseRightButtonDown" >
    
                        <c1grid:C1DataGrid.Columns>
    
                            <c1grid:DataGridTextColumn Header="{Binding Strings.strhdrSubcaseID, Source={StaticResource localization}}"  Binding="{Binding Path=SUBINCIDENT__ID_NUMBER}" FilterMemberPath="SUBINCIDENT__ID_NUMBER" SortMemberPath="SUBINCIDENT__ID_NUMBER"/>
                            <c1grid:DataGridTextColumn Header="{Binding Strings.strhdrWOStage, Source={StaticResource localization}}"  Binding="{Binding Path=WORK_ORDER__STATUS}" FilterMemberPath="WORK_ORDER__STATUS" SortMemberPath="WORK_ORDER__STATUS"/>
                            <c1grid:DataGridTextColumn Header="{Binding Strings.strhdrSLACondition, Source={StaticResource localization}}"  Binding="{Binding Path=WORK_ORDER__CONDITION}" FilterMemberPath="WORK_ORDER__CONDITION" SortMemberPath="WORK_ORDER__CONDITION"/>
                            <c1grid:DataGridTextColumn Header="Status" Binding="{Binding Path=STATUS}" FilterMemberPath="STATUS"  SortMemberPath="STATUS" Visibility="Collapsed"/>
                        </c1grid:C1DataGrid.Columns>
                    </c1grid:C1DataGrid>
    <TextBox  x:Name="txt_IDNumber"  Text="{Binding Path=SUBINCIDENT__ID_NUMBER}"  Grid.Row="0" Grid.Column="4" TextWrapping="Wrap"  Margin="4,0,0,4" VerticalAlignment="Stretch"
                                Height="22" FontSize="11" Style="{StaticResource TextboxStyle}" />
    
    
                </Grid>
         </Grid>

    I'm not using MVVM OR MVP pattern.



    Wednesday, January 18, 2017 7:49 AM

All replies

  • Hi asritha.reddy,

    As far as I know, we could not bind a list in TextBox in Silverlight application.

    According to your description, you want to show the SUBINCIDENT__ID_NUMBER property in TextBox when the related Item is selected in DataGrid control, is it right?

    We just need to add a SelectionChanged event for DataGrid and then change the Text property in this event to show the SUBINCIDENT__ID_NUMBER. Following sample code implement your requirement。 Hope that can help you.

    <sdk:DataGrid  HorizontalScrollBarVisibility="Auto" Grid.Row="1" x:Name="gridTest" SelectionChanged="gridTest_SelectionChanged"></sdk:DataGrid>
    <TextBox  x:Name="txt_IDNumber"  Text=""  Grid.Row="0" Grid.Column="4" TextWrapping="Wrap"  Margin="4,0,0,4" VerticalAlignment="Stretch"
                                Height="22" FontSize="11" />

     private void gridTest_SelectionChanged(object sender, SelectionChangedEventArgs e)
     {
          TestData selected = (TestData)gridTest.SelectedItem;
    
          txt_IDNumber.Text = selected.SUBINCIDENT__ID_NUMBER;
    
     }

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 19, 2017 2:31 AM
    Moderator