Welcome to the Xceed Community | Help
Community Search  
More Search Options

Access data object inside RowSelector

Sort Posts: Previous Next
  •  03-12-2010, 5:07 PM Post no. 26096

    Access data object inside RowSelector

    I'm trying to set the background of the RowSelector based on the value of a property in the underlying data (row) object.

    Ideally I would want to do something like this:

     

                    <Style TargetType="{x:Type xcdg:RowSelector}">

                        <Style.Triggers>

                            <DataTrigger Binding="{Binding Path=IsInternal}" Value="True">

                                <Setter Property="Background" Value="DarkOrange" />

                            </DataTrigger>

                        </Style.Triggers>

                    </Style> 

     

    where IsInternal is a property on my data object. However, it seems I can't predict the data context of a  RowSelector. Sometimes it's a Xceed.Wpf.DataGrid.DataRow, other times it's not.

    Please advise.

    -Alec. 

  •  03-15-2010, 10:40 AM Post no. 26102 in reply to 26096

    Re: Access data object inside RowSelector

    The DataContext of a RowSelector is its associated container. For all rows that represent data items, it will be Xceed.Wpf.DataGrid.DataRow. For the row selector that is associated with an InsertionRow, then the DataContext will be InsertionRow. You can check a RowSelector's RowType property to know the exact container type.
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.