Testa.cs Property or indexer 'System.Windows.UIElement.IsFocused' cannot be assigned to -- it is read only CS0200 304 8
ChartControl.ChartPanels[0].IsFocused = true;
protected void ChartControl_PreviewKeyDown(object sender, KeyEventArgs e)
{
// FOCUS on Chart's Window
TriggerCustomEvent(n =>
{
ChartControl.Dispatcher.InvokeAsync((Action)(() =>
{
if (Keyboard.IsKeyDown(Key.Insert) && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
{
ChartControl.ChartPanels[0].IsFocused = true;
ChartControl.ChartPanels[0].Focus();
Print("0 : " + ChartControl.ChartPanels[0].IsFocused);
}
}));
}, null);
e.Handled = true;
I want to set ChartControl.ChartPanels[0].IsFocused to true when pressing Ctrl+Insert while the focus is on a Quantity Selector TextBox.
The purpose is to shift the focus out of the Quantity Selector TextBox back to the Chart Panel.
ChartControl.ChartPanels[0].Focus(); doesn't work.
How can I enable
ChartControl.ChartPanels[0].IsFocused = true; ? Thanks!

Comment