Skip to content

Commit

Permalink
Merge pull request #422 from softlion/feature-MaterialTextField-readonly
Browse files Browse the repository at this point in the history
add readonly mode
  • Loading branch information
martijn00 authored Apr 26, 2021
2 parents e70ca0b + 3047072 commit e1779f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions XF.Material/UI/MaterialTextField.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,9 @@ private void OnHelpertTextFontFamilyChanged(string fontFamily)

private void OnInputTypeChanged()
{
entry.IsReadOnly = false;
entry.Keyboard = Keyboard.Default;

switch (InputType)
{
case MaterialTextFieldInputType.Chat:
Expand Down Expand Up @@ -1226,6 +1229,10 @@ private void OnInputTypeChanged()
case MaterialTextFieldInputType.SingleImmediateChoice:
case MaterialTextFieldInputType.CommandChoice:
break;

case MaterialTextFieldInputType.ReadOnly:
entry.IsReadOnly = true;
break;
}

// Hint: Will use this for MaterialTextArea
Expand Down
6 changes: 5 additions & 1 deletion XF.Material/UI/MaterialTextFieldInputType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public enum MaterialTextFieldInputType
/// <summary>
/// Triggers the command when clicked instead of focusing the input field
/// </summary>
CommandChoice
CommandChoice,
/// <summary>
/// Does not allow changes, and does not gray out the control
/// </summary>
ReadOnly
}
}

0 comments on commit e1779f8

Please sign in to comment.