نمایش نتایج 1 تا 3 از 3

نام تاپیک: کمک - توابعی جهت راحت سازی کار با گرید کنترل Devexpress

  1. #1
    کاربر دائمی آواتار arman_Delta2002
    تاریخ عضویت
    تیر 1387
    محل زندگی
    بابلسر
    سن
    37
    پست
    707

    Post کمک - توابعی جهت راحت سازی کار با گرید کنترل Devexpress

    سلام ما یک سری توابع نیاز داریم تا با گرید devexpress راحت تر بشه کار کرد من عنوان های اونا رو میزارم هرکی دوست داشت کمک کنه تا بتونیم این توابع رو در بیارم تا بشه روی گرید راهت و کامل کار کرد. مقادیر ورودی و خروجی توابع هم دست خودتونه. میدونم ممکنه بخشی از توابع نیاز به بعضی کد های xaml باشه اون رو نم به روش خودتون پیاده سازی کنین و اگر تابعی کاربردی به فکرتون رسید اضافه کنین.



    #region DevExpressGridControl
    /// <summary>
    /// انتقال به سلول
    /// </summary>
    public void FocusCell()
    {

    }
    /// <summary>
    /// مقدار سلول
    /// </summary>
    public void GetCellValue()
    {

    }
    /// <summary>
    /// دادن مقدار به سلول
    /// </summary>
    public void SetCellValue()
    {

    }

    /// <summary>
    /// دادن خطا یا پاک کردن خطا ولیدیت در سلول
    /// </summary>
    public void SetCellValidator()
    {

    }

    /// <summary>
    /// آیا سلول خطا دارد
    /// </summary>
    public void GetCellValidate()
    {

    }


    /// <summary>
    /// سلول در حالت ویرایش قرار میدهد
    /// </summary>
    public void CellEditMode()
    {

    }

    /// <summary>
    /// آیا سلول در حالت ویرایش است؟
    /// </summary>
    public void IsCellEditMode()
    {

    }

    /// <summary>
    /// رفتن به سلول مورد نظر
    /// </summary>
    public void MoveToCell()
    {

    }


    /// <summary>
    /// دادن رنگ به سلول
    /// </summary>
    public void SetCellColor()
    {

    }

    /// <summary>
    /// دادن رنگ به ردیف
    /// </summary>
    public void SetRowColor()
    {

    }


    /// <summary>
    /// دادن اندازه قلم به سلول
    /// </summary>
    public void SetCellFontSize()
    {

    }


    /// <summary>
    /// دادن اندازه قلم به یک ردیف خواص
    /// </summary>
    public void SetRowFontSize()
    {

    }

    #endregion
    آخرین ویرایش به وسیله arman_Delta2002 : جمعه 12 اردیبهشت 1399 در 20:36 عصر

  2. #2
    کاربر دائمی آواتار arman_Delta2002
    تاریخ عضویت
    تیر 1387
    محل زندگی
    بابلسر
    سن
    37
    پست
    707

    نقل قول: کمک - توابعی جهت راحت سازی کار با گرید کنترل Devexpress

    این توابع برای SfDataGrid کامپننت Syncfusion


    #region Syncfusion SfDataGrid <<<<حدف نـشود>>>>
    /// <summary>
    /// انتقال به سلول
    /// </summary>
    /// <param name="cellDisplayIndex">ایندکس سطون</param>
    /// <param name="rowIndex">gridControl.GetRowHandleByVisibleI ndex ایندکس ردیف</param>
    /// <param name="editMode">به حالت ویرایش برود</param>
    /// <returns>در حالت ویرایش است</returns>
    public static bool FocusCell(SfDataGrid dataGrid, int rowIndex, int cellDisplayIndex, bool editMode = false)
    {
    bool returnEditMode = false;
    RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, cellDisplayIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);

    if (editMode)
    {
    dataGrid.SelectionController.CurrentCellManager.Be ginEdit();
    returnEditMode = true;
    }

    return returnEditMode;
    }
    /// <summary>
    /// مقدار سلول
    /// args.CurrentRowColumnIndex.RowIndex;
    /// dataGrid.ResolveToGridVisibleColumnIndex(args.Curr entRowColumnIndex.ColumnIndex);
    /// </summary>
    public static string GetCellValue(SfDataGrid dataGrid, int rowIndex, int columnIndex)
    {
    if (columnIndex < 0)
    return "";
    // Get the mapping name
    var mappingName = dataGrid.Columns[columnIndex].MappingName;
    // Get the resolved current record index
    var recordIndex = dataGrid.ResolveToRecordIndex(rowIndex);
    if (recordIndex < 0)
    return "";

    if (dataGrid.View.TopLevelGroup != null)
    {
    // Get the current row record while grouping
    var record = dataGrid.View.TopLevelGroup.DisplayElements[recordIndex];
    if (!record.IsRecords) //skips caption summary, group summary rows
    return "";
    var data = (record as RecordEntry).Data;
    return data.GetType().GetRuntimeProperty(mappingName).Get Value(data).ToString();
    }
    else
    {
    // Get the current row record
    var record1 = dataGrid.View.Records.GetItemAt(recordIndex);
    return record1.GetType().GetRuntimeProperty(mappingName). GetValue(record1).ToString();
    }

    }
    /// <summary>
    /// دادن مقدار به سلول
    /// </summary>
    public static bool SetCellValue(SfDataGrid sfdatagrid, object value, int rowIndex, int columnIndex)
    {
    //int currentcellIndex = 0;
    //int currentRowIndex = 0;
    //bool currentCellIsEditing = false;
    //RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);
    //sfdatagrid.MoveCurrentCell(rowColumnIndex);
    //currentCellIsEditing = sfdatagrid.SelectionController.CurrentCellManager. CurrentCell.;

    //if (sfdatagrid.GetRecordsCount() > 0)
    //{
    // rowColumnIndex = new RowColumnIndex(currentRowIndex, currentcellIndex);
    // sfdatagrid.MoveCurrentCell(rowColumnIndex);
    //}

    try
    {
    sfdatagrid.View.GetPropertyAccessProvider().SetVal ue(sfdatagrid.GetRecordAtRowIndex(rowIndex), sfdatagrid.Columns[columnIndex].MappingName, (value).ToString());
    return true;
    }
    catch (Exception ex)
    {
    //نوع داده همسان با پروپرتی کلاس داده نیست
    return false;
    }
    }

    ///// <summary>
    ///// دادن خطا یا پاک کردن خطا ولیدیت در سلول
    ///// GridValidationMode="InView"
    ///// </summary>
    //public void SetCellValidator(SfDataGrid dataGrid, int rowIndex, int columnIndex, string validationText, int validatonType=0)
    //{
    // int columnIndex = dataGrid.ResolveToGridVisibleColumnIndex(args.RowC olumnIndex.ColumnIndex);

    // //We are enabling the RowValidating, CellValidating event if the changes happen in GridCheckBoxColumn

    // if (dataGrid.Columns[columnIndex].CellType == "CheckBox")
    // {
    // dataGrid.GetValidationHelper().;
    // dataGrid.GetValidationHelper().SetCurrentCellValid ated(false);
    // }
    //}

    ///// <summary>
    ///// آیا سلول خطا دارد
    ///// </summary>
    //public void GetCellValidate(SfDataGrid dataGrid,)
    //{

    //}


    /// <summary>
    /// سلول در حالت ویرایش قرار میدهد
    /// </summary>
    public static void CellEditMode(SfDataGrid dataGrid, int rowIndex, int columnIndex)
    {

    RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);

    dataGrid.SelectionController.CurrentCellManager.Be ginEdit();
    }

    /// <summary>
    /// آیا سلول در حالت ویرایش است؟
    /// int rowNumber = DataGrid.SelectedIndex;
    ///int colIndex = DataGrid.SelectionController.CurrentCellManager.Cu rrentRowColumnIndex.ColumnIndex;
    /// </summary>
    public static bool IsCellEditMode(SfDataGrid dataGrid, int rowIndex, int columnIndex)
    {
    int currentcellIndex = 0;
    int currentRowIndex = 1;
    bool currentCellIsEditing = false;
    RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);
    currentCellIsEditing = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.IsEditing;

    if (dataGrid.GetRecordsCount() > 0)
    {
    rowColumnIndex = new RowColumnIndex(currentRowIndex, currentcellIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);
    }
    return currentCellIsEditing;
    }

    /// <summary>
    /// رفتن به سلول مورد نظر
    /// int rowNumber = DataGrid.SelectedIndex;
    /// int colIndex = DataGrid.SelectionController.CurrentCellManager.Cu rrentRowColumnIndex.ColumnIndex;
    /// </summary>
    public static void MoveToCell(SfDataGrid dataGrid, int rowIndex, int columnIndex)
    {
    RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);
    var record = dataGrid.GetRecordAtRowIndex(rowIndex);
    var column = dataGrid.Columns[columnIndex];
    dataGrid.SelectCell(record, column);
    dataGrid.MoveCurrentCell(rowColumnIndex, true);
    }


    /// <summary>
    /// دادن رنگ به سلول
    /// </summary>
    public static void SetCellColor(SfDataGrid dataGrid, int rowIndex, int columnIndex, System.Windows.Media.Brush brushes)
    {
    int currentcellIndex = 0;
    int currentRowIndex = 1;
    if (dataGrid.SelectionController.CurrentCellManager.C urrentCell != null)
    {
    currentcellIndex = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.ColumnIndex;
    currentRowIndex = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.RowIndex;
    }

    RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);
    ((Syncfusion.UI.Xaml.Grid.GridCell)dataGrid.Select ionController.CurrentCellManager.CurrentCell.Colum nElement).Background = brushes;
    if (dataGrid.GetRecordsCount() > 0)
    {
    rowColumnIndex = new RowColumnIndex(currentRowIndex, currentcellIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);
    }
    }

    ///// <summary>
    ///// دادن رنگ به ردیف
    ///// </summary>
    //public static void SetRowColor(SfDataGrid dataGrid, int rowIndex, System.Windows.Media.Brushes brushes)
    //{
    // int currentcellIndex = 0;
    // int currentRowIndex = 1;
    // if (dataGrid.SelectionController.CurrentCellManager.C urrentCell != null)
    // {
    // currentcellIndex = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.ColumnIndex;
    // currentRowIndex = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.RowIndex;
    // }

    // RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, 0);
    // dataGrid.MoveCurrentCell(rowColumnIndex);
    // ((Syncfusion.UI.Xaml.Grid.GridCell)dataGrid.Select ionController.SelectedRows. = brushes;
    // if (dataGrid.GetRecordsCount() > 0)
    // {
    // rowColumnIndex = new RowColumnIndex(currentRowIndex, currentcellIndex);
    // dataGrid.MoveCurrentCell(rowColumnIndex);
    // }



    // var rowIndex = AssociatedObject.ResolveToRowIndex(record);
    // Dispatcher.BeginInvoke
    // (System.Windows.Threading.DispatcherPriority.Appli cationIdle,
    // new Action(() =>
    // {
    // if (e.Row.RowState == DataRowState.Modified)
    // {
    // var currentRow = AssociatedObject.RowGenerator.Items.FirstOrDefault (r => r.RowIndex == rowIndex);
    // if (currentRow != null)
    // {
    // var element = currentRow.Element as VirtualizingCellsControl;
    // element.Background = new SolidColorBrush(Colors.LightYellow);
    // }
    // }

    // ));

    //}


    ///// <summary>
    ///// دادن اندازه قلم به سلول
    ///// </summary>

    public static void SetCellFont(SfDataGrid dataGrid, int rowIndex, int columnIndex, System.Windows.FontStyle fontStyle, double fontSize = -1, System.Windows.Media.FontFamily fontFamily = null)
    {
    int currentcellIndex = 0;
    int currentRowIndex = 1;
    if (dataGrid.SelectionController.CurrentCellManager.C urrentCell != null)
    {
    currentcellIndex = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.ColumnIndex;
    currentRowIndex = dataGrid.SelectionController.CurrentCellManager.Cu rrentCell.RowIndex;
    }

    RowColumnIndex rowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);
    dataGrid.MoveCurrentCell(rowColumnIndex);
    if (fontSize != -1)
    {
    ((Syncfusion.UI.Xaml.Grid.GridCell)dataGrid.Select ionController.CurrentCellManager.CurrentCell.Colum nElement).FontSize = fontSize;
    }
    if (fontFamily != null)
    {
    ((Syncfusion.UI.Xaml.Grid.GridCell)dataGrid.Select ionController.CurrentCellManager.CurrentCell.Colum nElement).FontFamily = fontFamily;
    }

    ((Syncfusion.UI.Xaml.Grid.GridCell)dataGrid.Select ionController.CurrentCellManager.CurrentCell.Colum nElement).FontStyle = fontStyle;



    if (dataGrid.GetRecordsCount() > 0 && dataGrid.Columns.Count > 0)
    {

    rowColumnIndex = new RowColumnIndex(currentRowIndex, dataGrid.ResolveToGridVisibleColumnIndex(currentce llIndex));
    dataGrid.MoveCurrentCell(rowColumnIndex);
    }
    }

    #endregion

  3. #3
    کاربر دائمی آواتار arman_Delta2002
    تاریخ عضویت
    تیر 1387
    محل زندگی
    بابلسر
    سن
    37
    پست
    707

    نقل قول: کمک - توابعی جهت راحت سازی کار با گرید کنترل Devexpress

    این هم توابع کار با DevExpress Grid حدود 1 هفته زمان برد



    #region DevExpressGridControl
    /// <summary>
    /// انتقال به سلول
    /// </summary>
    /// <param name="cellDisplayIndex">ایندکس سطون</param>
    /// <param name="rowIndex">gridControl.GetRowHandleByVisibleI ndex ایندکس ردیف</param>
    /// <param name="editMode">به حالت ویرایش برود</param>
    /// uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    /// <returns>در حالت ویرایش است</returns>
    public static bool FocusCell(GridControl gridControl, int rowIndex, int cellDisplayIndex, bool editMode = false)
    {
    bool returnEditMode = false;

    gridControl.View.FocusedRowHandle = rowIndex;
    gridControl.SelectItem(rowIndex);
    if (gridControl.View.NavigationStyle == GridViewNavigationStyle.Cell)
    {
    if (gridControl.Columns.Count > cellDisplayIndex)
    {

    //tableView.FocusedRowHandle = rowIndex;
    if (gridControl.IsValidRowHandle(rowIndex))
    {
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);

    if (cellEleent != null && cellEleent.IsVisible)
    {

    gridControl.Columns[cellDisplayIndex].Focus();
    gridControl.View.FocusedRowHandle = rowIndex;

    cellEleent.Focus();
    if (editMode && cellEleent.IsEnabled)
    {
    //System.Windows.Threading.Dispatcher.BeginInvoke(ne w Action(() => {
    gridControl.View.ShowEditor(true);
    //}), DispatcherPriority.Render);
    returnEditMode = true;
    }
    }
    }

    }
    }

    return returnEditMode;
    }
    /// <summary>
    /// مقدار سلول
    /// </summary>
    public static object GetCellValue(GridControl gridControl, int rowIndex, int cellDisplayIndex)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return null;

    return gridControl.GetCellValue(rowIndex, gridControl.Columns[cellDisplayIndex]);
    }
    /// <summary>
    /// دادن مقدار به سلول
    /// در تابع CellValueChanged استفاده نشود!!!!
    /// مگر با استفاده از این شرط
    /// var currentCellData = e.Value;
    /// if (currentCellData == null || e.Value.ToString() == e.OldValue.ToString())
    /// {
    /// return;
    /// }
    ///
    /// uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    /// </summary>
    public static bool SetCellValue(GridControl gridControl, int rowIndex, int cellDisplayIndex, object cellData)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return false;
    try
    {
    gridControl.SetCellValue(rowIndex, gridControl.Columns[cellDisplayIndex], cellData);
    return true;
    }
    catch (Exception)
    {
    return false;
    }
    }

    /// <summary>
    /// دادن خطا یا پاک کردن خطا ولیدیت در سلول
    /// uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    /// </summary>
    public static bool SetCellValidator(GridControl gridControl, int rowIndex, int cellDisplayIndex)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return false;
    try
    {
    gridControl.View.FocusedRowHandle = rowIndex;
    gridControl.SelectItem(rowIndex);
    if (gridControl.View.NavigationStyle == GridViewNavigationStyle.Cell)
    {
    if (gridControl.Columns.Count > cellDisplayIndex)
    {

    //tableView.FocusedRowHandle = rowIndex;
    if (gridControl.IsValidRowHandle(rowIndex))
    {
    FrameworkElement cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);


    gridControl.Columns[cellDisplayIndex].Focus();
    gridControl.View.FocusedRowHandle = rowIndex;

    cellEleent.Focus();

    var cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);

    // var validationError = BaseEdit.ShowErrorProperty(cellElement.CellData);
    //BorderThickness
    DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;
    var readerItem = ((InplaceBaseEdit)lightweightCellEditor.Content);
    var testboxTemp = readerItem.Settings;
    if (testboxTemp is DevExpress.Xpf.Editors.Settings.TextEditSettings)
    {
    var eee= ((DevExpress.Xpf.Editors.Settings.TextEditSettings )testboxTemp);

    }
    //}), DispatcherPriority.Render);
    return true;

    }

    }
    }
    return true;
    }
    catch (Exception)
    {
    return false;
    }
    }

    ///// <summary>
    ///// آیا سلول خطا دارد
    ///uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    ///// </summary>
    public static bool GetCellValidate(GridControl gridControl, int rowIndex, int cellDisplayIndex)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return false;

    var cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var result = cellElement.GetType()
    .InvokeMember("HasEditorError",
    BindingFlags.InvokeMethod |
    BindingFlags.NonPublic |
    BindingFlags.Instance,
    null,
    cellElement,
    null);

    if (result == null)
    {
    return false;
    }

    return (bool)result;
    }


    ///// <summary>
    ///// سلول در حالت ویرایش قرار میدهد
    ///uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    ///// </summary>
    public static bool CellEditMode(GridControl gridControl, int rowIndex, int cellDisplayIndex)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return false;


    var cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);

    DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;

    var result = lightweightCellEditor.Edit.IsReadOnly;

    if (result == null)
    {
    return false;
    }
    cellElement.Focus();
    cellElement.ShowEditor();
    return true;
    }


    ///// <summary>
    ///// آیا سلول در حالت ویرایش است؟
    ///uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    ///// </summary>
    public static bool CellIsEditMode(GridControl gridControl, int rowIndex, int cellDisplayIndex)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return false;

    CellEditorBase cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);
    DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;
    if (cellElement.IsFocusedCell )
    {
    var result = lightweightCellEditor.Edit.IsReadOnly;

    if (result == null || (bool)result != false)
    {
    return false;
    }
    if (!cellElement.CanShowEditor())
    {
    return false;
    }
    //if (!cellElement.Edit.IsEditorActive)
    //{
    // return false;
    //}
    //return cellEleent.IsKeyboardFocused;
    return true;
    }

    return false;

    // (bool)readOnlyData;
    //cellElement.CanShowEditor();
    // CanShowEditor
    //cellEleent.IsKeyboardFocused;
    }

    ///// <summary>
    ///// رفتن به سلول مورد نظر
    ///// </summary>
    public static void MoveToCell(GridControl gridControl, int rowIndex, int cellDisplayIndex)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return;

    CellEditorBase cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);

    cellEleent.Focus();
    //cellElement.ShowEditor();
    }


    /////// <summary>
    /////// دادن رنگ به سلول
    /////// </summary>
    //public static void SetCellBorderColor(GridControl gridControl, int rowIndex, int cellDisplayIndex, System.Windows.Media.Brush borderColor)
    //{
    // if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    // return;


    // CellEditorBase cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    // var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);
    // DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;
    // lightweightCellEditor.BorderBrush = borderColor;

    //}

    ///// <summary>
    ///// دادن رنگ به سلول
    ///// </summary>
    public static void SetCellColor(GridControl gridControl, int rowIndex, int cellDisplayIndex, System.Windows.Media.Brush backgroundColor)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return;

    CellEditorBase cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);
    DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;
    lightweightCellEditor.Background = backgroundColor;
    }

    ///// <summary>
    ///// دادن رنگ به ردیف
    ///// </summary>
    public static void SetRowColor(GridControl gridControl, int rowIndex, System.Windows.Media.Brush backgroundColor)
    {
    if (!gridControl.IsValidRowHandle(rowIndex))
    return;


    var rowEleent = gridControl.View.GetRowElementByRowHandle(rowIndex );
    DevExpress.Xpf.Grid.RowControl lightweightRowControl = (DevExpress.Xpf.Grid.RowControl)rowEleent;
    lightweightRowControl.Background = backgroundColor;
    }


    ///// <summary>
    ///// دادن اندازه قلم به سلول
    ///uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex
    ///// </summary>
    public static void SetCellFontSize(GridControl gridControl, int rowIndex, int cellDisplayIndex,double fontSize)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return;

    CellEditorBase cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);
    DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;
    lightweightCellEditor.FontSize = fontSize;
    }


    ///// <summary>
    ///// دادن اندازه قلم به یک ردیف خواص
    ///uxTableView_MoreBarCode.FocusedRowHandle
    ///uxTableView_MoreBarCode.FocusedColumn.VisibleIndex 2
    ///// </summary>
    public static void SetRowFontSize(GridControl gridControl, int rowIndex, int cellDisplayIndex, System.Windows.Media.FontFamily fontFamily)
    {
    if (!gridControl.IsValidRowHandle(rowIndex) || gridControl.Columns.Count < cellDisplayIndex)
    return;

    CellEditorBase cellElement = (CellEditorBase)gridControl.View.GetCellElementByR owHandleAndColumn(rowIndex, gridControl.Columns[cellDisplayIndex]);
    var cellEleent = gridControl.View.GetCellElementByRowHandleAndColum n(rowIndex, gridControl.Columns[cellDisplayIndex]);
    DevExpress.Xpf.Grid.LightweightCellEditor lightweightCellEditor = (DevExpress.Xpf.Grid.LightweightCellEditor)cellEle ent;
    lightweightCellEditor.FontFamily = fontFamily;
    }

    #endregion


    واقا کار سختی بود و تو اینترنت هم هیچ کجا کدی در این باره نبود همش وصل اش میکردن به معماری mvvm داغون
    آخرین ویرایش به وسیله arman_Delta2002 : دوشنبه 15 اردیبهشت 1399 در 19:54 عصر

تاپیک های مشابه

  1. کوتاه سازی کلاس ها توابعی که صدا میزنیم
    نوشته شده توسط H:Shojaei در بخش CodeIgniter
    پاسخ: 2
    آخرین پست: یک شنبه 22 فروردین 1395, 11:23 صبح
  2. حرفه ای: برنامه ای که احتمالاً می تواند محیط مجازی (مثل Virtual PC و یا VmWare) را از محیط واقعی تشخیص دهد
    نوشته شده توسط BORHAN TEC در بخش مباحث عمومی دلفی و پاسکال
    پاسخ: 4
    آخرین پست: شنبه 06 شهریور 1389, 14:59 عصر
  3. توابعی که با @ شروع میشن چه جور توابعی هستند؟
    نوشته شده توسط resident در بخش PHP
    پاسخ: 6
    آخرین پست: یک شنبه 30 دی 1386, 00:28 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •