Skip to content

Commit fae3cc6

Browse files
docs(AI, TimePicker): ticket-related improvements (#3065)
Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
1 parent 522742d commit fae3cc6

File tree

2 files changed

+26
-63
lines changed

2 files changed

+26
-63
lines changed

ai/mcp-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The Telerik Blazor [MCP Server](https://modelcontextprotocol.io/introduction) le
1616

1717
To use the Telerik Blazor MCP server, you need:
1818

19+
* [Node.js](https://nodejs.org/en) 18 or a newer version.
1920
* A [compatible MCP client (IDE, code editor or app)](https://modelcontextprotocol.io/clients) that supports *MCP tools*. Using the latest version of the MCP client is recommended.
2021
* A [Telerik user account](https://www.telerik.com/account/).
2122
* An active [DevCraft or Telerik UI for Blazor license](https://www.telerik.com/purchase/blazor-ui) or a [Telerik UI for Blazor trial](https://www.telerik.com/blazor-ui).

components/timepicker/events.md

Lines changed: 25 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,30 @@ This article explains the events available in the Telerik TimePicker for Blazor:
2222

2323
The `ValueChanged` event fires upon every change (for example, keystroke) in the input, and upon clicking the `Set` or `Now` buttons in the dropdown.
2424

25-
>caption Handle ValueChanged
25+
The event handler receives the new value as an argument and you must update the component `Value` programmatically for the user changes to take effect.
2626

27-
````RAZOR
28-
@result
29-
<br />
30-
31-
<TelerikTimePicker ValueChanged="@( (DateTime d) => MyValueChangeHandler(d) )"></TelerikTimePicker>
32-
33-
@code {
34-
string result;
35-
36-
private void MyValueChangeHandler(DateTime theUserInput)
37-
{
38-
result = string.Format("The user entered: {0}", theUserInput);
39-
}
40-
}
41-
````
42-
43-
@[template](/_contentTemplates/common/general-info.md#event-callback-can-be-async)
44-
45-
@[template](/_contentTemplates/common/issues-and-warnings.md#valuechanged-lambda-required)
46-
47-
>caption Handle ValueChanged and provide initial value
27+
>caption Handle the TimePicker ValueChanged event
4828
4929
````RAZOR
50-
@result
30+
@Result
5131
<br />
52-
model value: @thePickerValue
32+
TimePicker Value: @TimePickerValue
5333
<br />
5434
55-
<TelerikTimePicker Value="@thePickerValue" ValueChanged="@( (DateTime d) => MyValueChangeHandler(d) )"></TelerikTimePicker>
35+
<TelerikTimePicker Value="@TimePickerValue"
36+
ValueChanged="@( (DateTime d) => TimePickerValueChanged(d) )">
37+
</TelerikTimePicker>
5638
5739
@code {
58-
string result;
40+
private string Result { get; set; } = string.Empty;
5941
60-
DateTime thePickerValue { get; set; } = DateTime.Now;
42+
private DateTime TimePickerValue { get; set; } = DateTime.Now;
6143
62-
private void MyValueChangeHandler(DateTime theUserInput)
44+
private void TimePickerValueChanged(DateTime newValue)
6345
{
64-
result = $"The user entered: {theUserInput}";
46+
Result = $"The user entered: {newValue}";
6547
66-
//you have to update the model manually because handling the ValueChanged event does not let you use @bind-Value
67-
thePickerValue = theUserInput;
48+
TimePickerValue = newValue;
6849
}
6950
}
7051
````
@@ -75,22 +56,27 @@ The `OnChange` event represents a user action - confirmation of the current valu
7556

7657
The time picker is a generic component, so you must provide either a `Value`, or a type to the `T` parameter of the component.
7758

78-
>caption Handle OnChange
59+
>caption Handle the TimePicker OnChange event
7960
8061
````RAZOR
81-
@result
62+
@Result
63+
<br />
64+
TimePicker Value: @TimePickerValue
8265
<br />
8366
84-
<TelerikTimePicker T="DateTime" OnChange="@MyOnChangeHandler"></TelerikTimePicker>
67+
<TelerikTimePicker @bind-Value="@TimePickerValue"
68+
OnChange="OnTimePickerChange">
69+
</TelerikTimePicker>
8570
8671
@code {
87-
string result;
72+
private string Result { get; set; } = string.Empty;
73+
74+
private DateTime TimePickerValue { get; set; } = DateTime.Now;
8875
89-
private void MyOnChangeHandler(object theUserInput)
76+
private void OnTimePickerChange(object currentValue)
9077
{
91-
// the handler receives an object that you may need to cast to the type of the component
92-
// if you do not provide a Value, you must provide the Type parameter to the component
93-
result = string.Format("The user entered: {0:HH:mm:ss}", (DateTime)theUserInput);
78+
// Cast the event argument to the actual value type
79+
Result = $"The user entered: {(DateTime)currentValue}";
9480
}
9581
}
9682
````
@@ -99,30 +85,6 @@ The time picker is a generic component, so you must provide either a `Value`, or
9985

10086
>tip The `OnChange` event is a custom event and does not interfere with bindings, so you can use it together with models and forms.
10187
102-
>caption Handle OnChange and use two-way binding
103-
104-
````RAZOR
105-
@result
106-
<br />
107-
model value: @thePickerValue
108-
<br />
109-
110-
<TelerikTimePicker @bind-Value="@thePickerValue" OnChange="@MyOnChangeHandler"></TelerikTimePicker>
111-
112-
@code {
113-
string result;
114-
115-
DateTime? thePickerValue { get; set; } = DateTime.Now;
116-
117-
private void MyOnChangeHandler(object theUserInput)
118-
{
119-
// the handler receives an object that you may need to cast to the type of the component
120-
// if you do not provide a Value, you must provide the Type parameter to the component
121-
result = string.Format("The user entered: {0}", (theUserInput as DateTime?).Value);
122-
}
123-
}
124-
````
125-
12688
## OnOpen
12789

12890
The `OnOpen` event fires before the TimePicker popup renders.

0 commit comments

Comments
 (0)