如何绑定3个组合框POWERSHELL和WPF

时间:2015-12-09 19:07:57

标签: wpf xaml powershell combobox

这是我的问题:我有3个ComboBox es从mdb文件中读取数据。

第一个中的选定值将影响第二个中显示的内容,而第二个中的选定值将影响第三个中的显示内容。第三个结果将填入TextBox

example

以下是我用来加载数据的代码:

function GetData() {

    $objOleDbConnection1= New-Object "System.Data.OleDb.OleDbConnection"
    $objOleDbCommand = New-Object "System.Data.OleDb.OleDbCommand"
    $objOleDbAdapter = New-Object "System.Data.OleDb.OleDbDataAdapter"
    $objDataTable = New-Object "System.Data.DataTable"

    $objOleDbConnection1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Script\test_1.mdb;"
    $objOleDbConnection1.Open()
    $objOleDbCommand.Connection = $objOleDbConnection1
    $objOleDbCommand.CommandText = "SELECT SORT + ' ' + '-' + ' ' + Tekst, SAPstruktur FROM SAPstruktur where SAPstruktur like 'A__' ORDER BY ID ASC"

    #set the Adapter object
    $objOleDbAdapter.SelectCommand = $objOleDbCommand

    #fill the objDataTable object with the results
    $objOleDbAdapter.Fill($objDataTable)
    return $objDataTable.DefaultView
    $objOleDbConnection1.Close()
}

这是我的组合框#1的XAML代码:

<ComboBox x:Name="mdb" HorizontalAlignment="Left" VerticalAlignment="Top" Width="275" Grid.Column="1"  DisplayMemberPath="Expr1000" SelectedValuePath="SAPstruktur" ItemsSource="{Binding PsList[GetData]}" SelectedIndex="0"/>

问题:如何连接所有这3个组合框?我设法填充所有三个组合框(调用函数GetData,GetData1等),但我不知道如何将它们连接在一起。

我使用WPF对话窗口(XAML)+ PowerShell文件,所以我猜这个动作发生在ps1中,它将结果发送到XAML。

提前致谢!

1 个答案:

答案 0 :(得分:3)

这是一个非常简单的工作示例。

bin/spark-shell -conf spark.cassandra.connection.host=172.21.0.131 --conf spark.cassandra.auth.username=adminxx --conf spark.cassandra.auth.password=adminxx 中选择某个项目后,void MapCanvas::renderText(double x, double y, double z, const QString &str, const QFont & font = QFont()) { // Identify x and y locations to render text within widget int height = this->height(); GLdouble textPosX = 0, textPosY = 0, textPosZ = 0; project(x, y, 0f, &textPosX, &textPosY, &textPosZ); textPosY = height - textPosY; // y is inverted // Retrieve last OpenGL color to use as a font color GLdouble glColor[4]; glGetDoublev(GL_CURRENT_COLOR, glColor); QColor fontColor = QColor(glColor[0], glColor[1], glColor[2], glColor[3]); // Render text QPainter painter(this); painter.setPen(fontColor); painter.setFont(font); painter.drawText(textPosX, textPosY, text); painter.end(); } 将被清空并填入适当的值。

ComboBox1

根据我在此处阅读的内容:CassandraRdd.map( row => row.getInt("id)) does not work , java.lang.ClassNotFoundException happened!