Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
enable/disable a button within a XamGrid
posted

How do I enable/disable a button within a XamGrid? Below is an example xaml and I need to be able to enable/disable the buttonShipTo based on some business log.

 <ig:XamGrid x:Name="gridPO" ColumnWidth="*" AutoGenerateColumns="False" CellEnteredEditMode="gridPO_CellEnteredEditMode" DeleteKeyAction="DeleteRowsOfSelectedCellsAndRows"                             
                                     RowEnteredEditMode="gridPO_RowEnteredEditMode" RowExitedEditMode="gridPO_RowExitedEditMode" Margin="0,20,5,5"
                                CellExitingEditMode="gridPO_CellExitingEditMode" RowExitingEditMode="gridPO_RowExitingEditMode" Height="250">

<ig:UnboundColumn Key="unboundButton" IsFilterable="False" Width="55" >
                                <ig:UnboundColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="Ship To"/>
                                    </DataTemplate>
                                </ig:UnboundColumn.HeaderTemplate>
                                <ig:UnboundColumn.ItemTemplate>
                                    <DataTemplate>
                                        <Button x:Name="buttonShipTo" Content="Ship To" Click="buttonShipTo_Click" Height="20" Margin="0"
                                                Tag="{Binding ClubName}"/>
                                    </DataTemplate>
                                </ig:UnboundColumn.ItemTemplate>
                            </ig:UnboundColumn>
                            
               </ig:XamGrid.Columns>
</ig:XamGrid>

 

 

Parents
  • 40030
    Offline posted

    Hi,

    I'm guessing the logic to determine if the button is enabled/disabled is on a row level. 

    if that correct, then you just need a Binding with a  ValueConverter attached to the IsEnabled property of the button. Where the ValueConverter performs the logic.

    Or you can simply just add a property to the underlying data object that resolves to true or false based on your evaluation logic, and raise the PropretyChanged event off of your data object when it changes. 

    -SteveZ

Reply Children
No Data