DevExpress Dashboard建立儀表盤參數

首先找到Ribbon菜單中的Data Source,而後單擊它下面的Parameters,如圖:編輯器

DevExpress Dashboard Parameters

在彈出的對話框中單擊Add添加新參數:spa

DevExpress Dashboard Add

指定如下設置:code

Settings Description API
Name 指定參數名 Parameter.Name
Value 指定參數值 Parameter.Value
Type 指定參數類型 Parameter.Type
LookUpSettings 指定參數查詢編輯器設置 DashboardParameter.LookUpSettings
Description 指定展現給最終用戶的參數描述 DashboardParameter.Description
Visible 指定在Dashboard Parameters對話框中參數編輯器是否可見 DashboardParameter.Visible

最後單擊OK表示肯定。ip

查詢編輯器設置

查詢編輯器設置有三種方式(以下圖)。從LookUpSettings下拉列表中能夠選擇你須要的類型:string

  • No Look-Up - Value使用一個靜態值做爲參數io

No Look-Up

  • StaticList - 單擊省略號按鈕爲當前的儀表盤參數添加靜態值:table

StaticList

這樣Value就指定了默認的參數值。class

  • DynamicList - 從當前的數據源中選擇一系列的值。選擇須要的DataSource,還有儀表盤參數顯示名和值所需的數據元素:List

DynamicList

用代碼建立參數

儀表盤提供 Dashboard.Parameters 屬性,它用於訪問儀表盤參數。下面介紹一下如何用代碼來建立參數。im

首先,用查詢編輯器設置(DashboardParameter.LookUpSettings屬性)建立一個參數,而後將它添加到儀表盤的參數當中。參考代碼以下:

  • No Look-Up:

DashboardParameter parameter1 = new DashboardParameter("Parameter1", typeof(string), "Beverages", "", true, null);
  • StaticLis - 使用 StaticListLookUpSettings.Values 屬性去訪問儀表盤參數的靜態值:

StaticListLookUpSettings settings = new StaticListLookUpSettings();
settings.Values = new string[] {"Beverages", "Condiments"};
DashboardParameter parameter2 = new DashboardParameter("Parameter2", typeof(string), "Beverages", "", true, settings);
  • DynamicList - 使用 DynamicListLookUpSettings.DataSource 屬性指定儀表盤參數所需的數據源。DynamicListLookUpSettings.ValueMember和DynamicListLookUpSettings.DisplayMember能夠指定參數值的數據元素。

DynamicListLookUpSettings settings = new DynamicListLookUpSettings();
settings.DataSource = ds;
settings.ValueMember = "CategoryName";
settings.DisplayMember = "CategoryName";
DashboardParameter parameter3 = new DashboardParameter("Parameter3", typeof(string), "Beverages", "", true, settings);
相關文章
相關標籤/搜索