CommandParameter binding Introduction:

Design Patterns SampleCode

https://csharpdesignpatterns.codeplex.com/

DevExpress Support Center 

https://www.devexpress.com/

DevExpress Center

http://www.devexpress.com/Support/Center/Question/Details/T129527

mvc mvp mvvm comparision

 http://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/DPR305

 

<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>

 

http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/

http://stackoverflow.com/questions/7660967/wpf-error-cannot-find-govering-frameworkelement-for-target-element

http://stackoverflow.com/questions/7660967/wpf-error-cannot-find-govering-frameworkelement-for-target-element

DevExpressCenter:

http://www.devexpress.com/Support/Center/Question/Details/T129527

 

 

Messenger.Default.Send<long>(runId);

Messenger.Default.Register<int>(this,
(craneRptDate) =>
{
Task.Factory.StartNew(
() =>
{
IsProgressBarIndicatorBusy = true;
try
{
AccessCraneDataDetailsByWebService(craneRptDate);
}
catch (Exception ex)
{
logger.Error("Access CraneDataDetails By WebService Error", ex);
MessageBox.Show("AccessCraneDataDetailsByWebService: " + ex.Message);
}
IsProgressBarIndicatorBusy = false;
});
});

posted on 2014-07-16 17:45  JackSlaterYu  阅读(536)  评论(0编辑  收藏  举报