Query 1 : Is there a possibility to limit the second number to a maximum of 59? |
We have analyzed your query, we are suspect whether your are restrict the value above 59 or while exceed the second value above 59, added 1 to first vale.
You can add the one value if second value exceeded above 59 by using converter in Valuebinding as like below code.
| |
Query 2: if I write for example only a 5, with the arrow keys can continue so I land directly behind the double point. |
We couldn’t get your requirement clearly, we are suspect whether you are type the one digit value and hit the right or left arrow key curser position moves beyond that colon. Please share more details about your requirement. | |
Query 3: whether it is possible to lock certain cells in certain rows? |
You can cancel the editing for certain cell by using CurrentCellBeginEdit event.
Please refer the below UG link
|
Hi Gnanasownthari,
thank you for your answer. Regarding my second Question: In the score column i have the mask "00:00". If I now enter a 5 for example and then press the arrow key to the right, I would like to land behind the double point.
Best Regards
Hi Gnanasownthari,
the converter from my first question works very well. But is there perhaps a possibility to apply this with the CurrentCellValueChanged or PreviewTextInput and not only when I leave the cell?
this.dataGrid.CurrentCellValueChanged += DataGrid_CurrentCellValueChanged;
private void DataGrid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs e)
{
//You can do your own logic here.
var text = this.dataGrid.SelectionController.CurrentCellManager.CurrentCell.Renderer.GetControlValue();
if (e.Column.MappingName == "Time")
{
string[] splitedString = text.ToString().Split(':');
string first = splitedString[0];
int firstInt = Int32.Parse(first);
string second = splitedString[1];
int secondInt = Int32.Parse(second);
if (secondInt >= 60)
{
firstInt = firstInt + 1;
secondInt = 00;
if (firstInt <= 9)
text = "0" + firstInt.ToString() + ":" + secondInt.ToString();
else
text = firstInt.ToString() + ":" + secondInt.ToString();
this.Dispatcher.BeginInvoke(new Action(() =>
{
this.dataGrid.SelectionController.CurrentCellManager.CurrentCell.Renderer.SetControlValue(text);
}), DispatcherPriority.ApplicationIdle);
}
}
} |