Hi ,
I am trying to bind the state of a checkbox which is in the rowselector to the selected state of a row in a xam grid
here is the example of how i do this with a list box .
ListBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Height="120" HorizontalAlignment="Left" Name="lbRoles_AU" VerticalAlignment="Top" Width="120" SelectionMode="Multiple"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <CheckBox x:Name="cbRole" Content="{Binding Path=RoleName}" Height="16" HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource AncestorType=ListBoxItem},Mode=TwoWay}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
Here is the code i have so far. but i dont know what to put in the ancestor type.
<ig:XamGrid AutoGenerateColumns="False" Name="dgAddress" > <ig:XamGrid.RowSelectorSettings> <ig:RowSelectorSettings Visibility="Visible" EnableRowNumbering="False" > <ig:RowSelectorSettings.Style> <Style TargetType="ContentControl"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <CheckBox x:Name="cbRow" Checked="cbRow_Checked" Unchecked="cbRow_Unchecked" MouseLeftButtonDown="cbRow_MouseLeftButtonDown" IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource AncestorType= ???????},Mode=TwoWay}" /> </DataTemplate> </Setter.Value> </Setter> </Style> </ig:RowSelectorSettings.Style> </ig:RowSelectorSettings> </ig:XamGrid.RowSelectorSettings>
<ig:XamGrid AutoGenerateColumns="False" Name="dgAddress" >
<ig:XamGrid.RowSelectorSettings> <ig:RowSelectorSettings Visibility="Visible" EnableRowNumbering="False" > <ig:RowSelectorSettings.Style> <Style TargetType="ContentControl"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <CheckBox x:Name="cbRow" Checked="cbRow_Checked" Unchecked="cbRow_Unchecked" MouseLeftButtonDown="cbRow_MouseLeftButtonDown" IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource AncestorType= ???????},Mode=TwoWay}" /> </DataTemplate> </Setter.Value> </Setter> </Style> </ig:RowSelectorSettings.Style> </ig:RowSelectorSettings> </ig:XamGrid.RowSelectorSettings>
Could someone please guide me in the right direction
Thanks
Prakash
What you are looking for is this:
< CheckBox IsChecked="{Binding Cell.Row.Data.IsSelected, RelativeSource={RelativeSource AncestorType={x:Type prim:RowSelectorCellControl}}}" />
This is under the assumption that you have an IsSelected property to the object your binding to.
Hello,
I am just checking if you got this worked out, or you still require any assistance, or clarification on the matter.
If this is what you were looking for please verify the answer so it helps other users as well.
Hello Prakash,
I have sent your Product Idea directly to our product management team. Our product team chooses new Product Ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your friendly ID for this Product Idea is PI12060090.
If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email. Please include the reference number of your Product Idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.
Regarding accessing your RowSelector’s contents I can suggest you use something like this:
RowSelectorCellControl rscc = xamGrid1.ActiveCell.Row.Control.Children[0] as RowSelectorCellControl;
To get the RowSelector’s visual element.
Please let me know, I if I can be of any further assistance on the matter.
thanks for replying Petar,
Please submit the product idea. such functionality would be of great use for us.
also is how can i access the row selectors selected style..
i am planning to take the route where we change just the style so that it will be checked..
also is there a way where i can access the checkbox inside the row selector.
Thanks for your help
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.