<Window x:Class="OddEvenRows.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" Height="400" Width="300" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" Title="JackSlater" x:Name="jackWindow"> <Window.Resources> <FrameworkElement x:Key="ProxyElement" DataContext="{Binding Path=.,ElementName=noTB01}"/> </Window.Resources> <StackPanel> <ContentControl Visibility="Collapsed" Content="{StaticResource ProxyElement}"/> <StackPanel> <TextBlock x:Name="noTB01" Text="No.1"></TextBlock> <TextBlock x:Name="noTB02" Text="No.2"></TextBlock> <Button x:Name="testBtn" Content="Hello"></Button> </StackPanel> <Grid> <dxg:GridControl x:Name="gridControl" Grid.Row="2" MaxHeight="500" ItemsSource="{Binding MyList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> <dxg:GridControl.Columns> <dxg:GridColumn FieldName="Index"> <dxg:GridColumn.CellTemplate> <DataTemplate> <dxe:ComboBoxEdit Name="PART_Editor" IsTextEditable="False" > <dxe:ComboBoxEditItem x:Name="readyCombox" Content="ClickDownComboxItem"> <i:Interaction.Triggers> <i:EventTrigger EventName="PreviewMouseDown"> <cmd:EventToCommand Command="{Binding Path=View.DataContext.ImportCommand}" CommandParameter="{Binding Path=DataContext.Text, Source={StaticResource ProxyElement}}"/> </i:EventTrigger> </i:Interaction.Triggers> </dxe:ComboBoxEditItem> </dxe:ComboBoxEdit> </DataTemplate> </dxg:GridColumn.CellTemplate> </dxg:GridColumn> </dxg:GridControl.Columns> <dxg:GridControl.View> <dxg:TableView AutoWidth="True"/> </dxg:GridControl.View> </dxg:GridControl> </Grid> </StackPanel> </Window>
<Window x:Class="OddEvenRows.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" Height="400" Width="300" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" Title="JackSlater" x:Name="jackWindow"> <dxg:GridControl x:Name="gridControl" ItemsSource="{Binding MyList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> <dxg:GridControl.Columns> <dxg:GridColumn FieldName="Index"> <dxg:GridColumn.CellTemplate> <DataTemplate> <dxe:ComboBoxEdit EditValue="{Binding Data.Index,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsTextEditable="False" > <dxe:ComboBoxEditItem x:Name="readyCombox" Content="ClickDownComboxItem"> <i:Interaction.Triggers> <i:EventTrigger EventName="PreviewMouseDown"> <cmd:EventToCommand Command="{Binding Path=View.DataContext.ImportCommand}" CommandParameter="{Binding Path=View.DataControl.Parent}"/> </i:EventTrigger> </i:Interaction.Triggers> </dxe:ComboBoxEditItem> </dxe:ComboBoxEdit> </DataTemplate> </dxg:GridColumn.CellTemplate> </dxg:GridColumn> </dxg:GridControl.Columns> <dxg:GridControl.View> <dxg:TableView AutoWidth="True"/> </dxg:GridControl.View> </dxg:GridControl> </Window>
<Window x:Class="OddEvenRows.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" Height="400" Width="300" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" Title="JackSlater" x:Name="jackWindow"> <Window.Resources> <!--<FrameworkElement x:Key="ProxyElement" DataContext="{Binding noTB01}"/>--> <TextBlock x:Key="ProxyElement" DataContext="{Binding Path=.,ElementName=noTB01}"/> </Window.Resources> <StackPanel> <ContentControl Visibility="Collapsed" Content="{StaticResource ProxyElement}"/> <StackPanel> <TextBlock x:Name="noTB01" Text="No.1"></TextBlock> <TextBlock x:Name="noTB02" Text="No.2"></TextBlock> <Button x:Name="testBtn" Content="Hello"></Button> </StackPanel> <Grid> <dxg:GridControl x:Name="gridControl" Grid.Row="2" MaxHeight="500" ItemsSource="{Binding MyList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> <dxg:GridControl.Columns> <dxg:GridColumn FieldName="Index"> <dxg:GridColumn.CellTemplate> <DataTemplate> <dxe:ComboBoxEdit Name="PART_Editor" IsTextEditable="False" > <dxe:ComboBoxEditItem x:Name="readyCombox" Content="ClickDownComboxItem"> <i:Interaction.Triggers> <i:EventTrigger EventName="PreviewMouseDown"> <cmd:EventToCommand Command="{Binding Path=View.DataContext.ImportCommand}" CommandParameter="{Binding Path=DataContext.Text,Source={StaticResource ProxyElement}}"/> </i:EventTrigger> </i:Interaction.Triggers> </dxe:ComboBoxEditItem> </dxe:ComboBoxEdit> </DataTemplate> </dxg:GridColumn.CellTemplate> </dxg:GridColumn> </dxg:GridControl.Columns> <dxg:GridControl.View> <dxg:TableView AutoWidth="True"/> </dxg:GridControl.View> </dxg:GridControl> </Grid> </StackPanel> </Window>
DevExpressCenter:
http://www.devexpress.com/Support/Center/Question/Details/T129527
CommandParameter binding Introduction:,布布扣,bubuko.com
时间: 2024-10-06 01:19:23