私はComboBox列を持つTelerik GridViewを持っていますが、このComboboxで追加リストをドロップダウンしてフィルタリングしています。
下の画像と同じ...
なのでAppendリストのフォントを大きくしたいです。
どうやってするの?
私はComboBox列を持つTelerik GridViewを持っていますが、このComboboxで追加リストをドロップダウンしてフィルタリングしています。
下の画像と同じ...
なのでAppendリストのフォントを大きくしたいです。
どうやってするの?
RadDropDownList は、デフォルトのアイテム表現とオートコンプリートの提案アイテムに異なるポップアップを使用します。両方のフォントを変更する方法を示す例を次に示します。
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor;
if (editor != null)
{
editor.DropDownStyle = RadDropDownStyle.DropDown;
RadDropDownListEditorElement element = (RadDropDownListEditorElement)editor.EditorElement;
element.VisualItemFormatting -= element_VisualItemFormatting;
element.AutoCompleteSuggest.DropDownList.VisualItemFormatting -= element_VisualItemFormatting;
//this handles the default drop down formatting - when you press the arrow key to open the drop down
element.VisualItemFormatting += element_VisualItemFormatting;
//this handles the suggest popup formatting
element.AutoCompleteSuggest.DropDownList.VisualItemFormatting += element_VisualItemFormatting;
}
}
void element_VisualItemFormatting(object sender, VisualItemFormattingEventArgs args)
{
args.VisualItem.Font = new Font("Arial", 16);
}
フォントを使用して CellTemplate を作成するか、CellFormating
イベントを処理して次のようにすることができます。
void radGridView_CellFormatting(object sender, CellFormattingEventArgs e)
{
// For all cells under the Account Name column
if(e.CellElement.ColumnInfo.Name == "Account Name")
{
if(e.CellElement.Value != null)
{
System.Drawing.Font newfontsize = new System.Drawing.Font(e.CellElement.Font.FontFamily.Name,20);
for each(GridViewCellInfo cell in e.Row.Cells)
{
e.CellElement.Font = newfontsize;
}
}
}
// For all other cells under other columns
else
{
e.CellElement.ResetValue(Telerik.WinControls.UI.LightVisualElement.Font, Telerik.WinControls.ValueResetFlags.Local);
}
}
「newfontsize」変数に必要なサイズのフォントをプラグインします。また、else ステートメントは必要ない場合もありますが、ResetValue プロパティを使用してフォントをデフォルトにリセットできることに注意してください。