Click here to Skip to main content
15,890,185 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
AspDotNetDev17-Feb-10 22:03
protectorAspDotNetDev17-Feb-10 22:03 
GeneralRe: Button not firing in WPF Toolkit datagrid [modified] Pin
Hannes Larsson17-Feb-10 23:03
Hannes Larsson17-Feb-10 23:03 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
AspDotNetDev17-Feb-10 23:13
protectorAspDotNetDev17-Feb-10 23:13 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
Hannes Larsson17-Feb-10 23:15
Hannes Larsson17-Feb-10 23:15 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
AspDotNetDev17-Feb-10 23:42
protectorAspDotNetDev17-Feb-10 23:42 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
AspDotNetDev18-Feb-10 0:02
protectorAspDotNetDev18-Feb-10 0:02 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
Hannes Larsson18-Feb-10 1:39
Hannes Larsson18-Feb-10 1:39 
GeneralRe: Button not firing in WPF Toolkit datagrid Pin
Member 454056418-Feb-10 10:10
Member 454056418-Feb-10 10:10 
I still cant get this to work. I have tried every combination from posts about this subject but I am still running into the issue of it thinking I am selecting the entire row instead of firing off the button command.

PLEASE HELP!


<UserControl.Resources>
      <ObjectDataProvider  x:Key="Viewmodel"   ObjectType="{x:Type ViewModels:DocManagementViewModel}"/>
      <Utilities:ArithmeticConverter x:Key="arithConverter" />
      <Utilities:BooleanToVisibilityConverter x:Key="MyBooleanToVisibilityConverter" />
  </UserControl.Resources>



<Grid Margin="0,32.667,3,20"     Panel.ZIndex="2296" x:Name="LayoutGrid"         >
                  <Grid.ColumnDefinitions>
                      <ColumnDefinition/>
                      <ColumnDefinition Width="Auto" MinWidth="18.542"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                      <RowDefinition MinHeight="300"/>
                      <RowDefinition Height="Auto"/>
                  </Grid.RowDefinitions>


                  <Grid Margin="0,-20,7,0"  >
                      <Grid.RowDefinitions></Grid.RowDefinitions>
                      <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="Auto"></ColumnDefinition>
                          <ColumnDefinition Width="*"></ColumnDefinition>
                      </Grid.ColumnDefinitions>


                      <dg:DataGrid
                            Visibility="{Binding HideElement,  Converter={StaticResource MyBooleanToVisibilityConverter}}"
                               Grid.Column="1"  Cursor="Hand"
                               Margin="15.5,-19,17,12"
                               Grid.Row="0"
                               AlternationCount="2"
                               Panel.ZIndex="1000"
                           Style="{DynamicResource DataGridStyle}"
                               AutoGenerateColumns="False"
                               SelectedItem="{Binding SelectedPatientDocInfoItem}"
                               ItemsSource="{Binding PatientDocInfoCollection}"
                               x:Name="DocumentSearchResultsDG"
                               BorderThickness="0">
   <dg:DataGrid.Resources>

                              <Style TargetType="{x:Type dg:DataGridRowHeader}">
                                  <Setter Property="Background" Value="Transparent"/>
                              </Style>
                          </dg:DataGrid.Resources>
                          <dg:DataGrid.Columns>
                              <dg:DataGridTextColumn Binding="{Binding DocumentName}"  IsReadOnly="True" Width=".5*" Header="Doc Name"  />
                              <dg:DataGridTextColumn Binding="{Binding Category}"   IsReadOnly="True" Width=".5*"  Header="Category" />
                              <dg:DataGridTextColumn Binding="{Binding CreatedDate, StringFormat=\{0:MM/dd/yyyy\}}"   IsReadOnly="True" Width=".5*"  Header="Scanned Date" />
                              <dg:DataGridTextColumn Binding="{Binding CreatedByUserId}"   IsReadOnly="True" Width=".5*"  Header="Scanned By"  />
                              <dg:DataGridTextColumn Binding="{Binding Comment}"    IsReadOnly="True" Width=".5*"  Header="Comment" />
                              <dg:DataGridTemplateColumn     Header="Delete" Width="100"   >
                                  <dg:DataGridTemplateColumn.CellTemplate >
                                      <DataTemplate >
                                          <Button HorizontalAlignment="Center" Command="{Binding  Path=DataContext.DeleteItem, RelativeSource={RelativeSource  FindAncestor,  AncestorType={x:Type UserControl}}}" Margin="0,1,0,0" Height="15" Width="15"  Template="{DynamicResource RedGlassButton}" Style="{StaticResource CloseBtnStyle}" >

                                          </Button>
                                      </DataTemplate>
                                  </dg:DataGridTemplateColumn.CellTemplate>
                                  </dg:DataGridTemplateColumn>
                          </dg:DataGrid.Columns>
                      </dg:DataGrid>
                  </Grid>



              </Grid>


Here is my ViewModel

<br />
   public ICommand DeleteItem { get; private set; }<br />
   public DocManagementViewModel()<br />
        {           <br />
            DeleteItem = new DelegateCommand<object>(obj => DeleteDocumentGroup());<br />
        }<br />
<br />
  private void DeleteDocumentGroup()<br />
        {<br />
            PatientDocumentRepository.Delete(PatientDocument);<br />
}<br />

QuestionSharing Core Objects Between Server & Client Pin
Jammer12-Feb-10 7:57
Jammer12-Feb-10 7:57 
AnswerRe: Sharing Core Objects Between Server & Client Pin
Pete O'Hanlon12-Feb-10 9:33
mvePete O'Hanlon12-Feb-10 9:33 
GeneralRe: Sharing Core Objects Between Server & Client Pin
Jammer13-Feb-10 12:51
Jammer13-Feb-10 12:51 
QuestionPopup window in silverlight Pin
xodeblack12-Feb-10 6:01
xodeblack12-Feb-10 6:01 
AnswerRe: Popup window in silverlight Pin
Abhinav S12-Feb-10 8:10
Abhinav S12-Feb-10 8:10 
Questioncontrols visible in designer but not available in window at runtime [modified] Pin
Member 290565112-Feb-10 2:30
Member 290565112-Feb-10 2:30 
QuestionButton click event within a ControlTemplate? Pin
Richard Dutton12-Feb-10 1:02
Richard Dutton12-Feb-10 1:02 
AnswerRe: Button click event within a ControlTemplate? Pin
rhuiden12-Feb-10 4:59
rhuiden12-Feb-10 4:59 
GeneralRe: Button click event within a ControlTemplate? Pin
Richard Dutton12-Feb-10 5:05
Richard Dutton12-Feb-10 5:05 
QuestionMessage Removed Pin
11-Feb-10 7:39
fjparisIII11-Feb-10 7:39 
AnswerRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 8:24
mentorNot Active11-Feb-10 8:24 
GeneralMessage Removed Pin
11-Feb-10 8:43
fjparisIII11-Feb-10 8:43 
GeneralRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 9:18
mentorNot Active11-Feb-10 9:18 
GeneralMessage Removed Pin
11-Feb-10 9:46
fjparisIII11-Feb-10 9:46 
GeneralRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 10:53
mentorNot Active11-Feb-10 10:53 
GeneralMessage Removed Pin
11-Feb-10 11:21
fjparisIII11-Feb-10 11:21 
GeneralRe: Initial impression: Silverlight much harder than WPF Pin
Not Active11-Feb-10 11:42
mentorNot Active11-Feb-10 11:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.