Skip to content

Commit be488d1

Browse files
authored
Update CustomNumericTextBoxRenderer.cs
1 parent 488f11b commit be488d1

File tree

1 file changed

+3
-38
lines changed

1 file changed

+3
-38
lines changed

GettingStarted_NumericTextBox/GettingStarted_NumericTextBox.UWP/CustomNumericTextBoxRenderer.cs

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,13 @@ public class CustomNumericTextBoxRenderer : SfNumericTextBoxRenderer
2020
protected override void OnElementChanged(ElementChangedEventArgs<SfNumericTextBox> e)
2121
{
2222
base.OnElementChanged(e);
23+
2324
if (Control != null)
2425
{
25-
Control.Loaded += Control_Loaded;
26+
Control.ShowClearButton = false;
2627
}
2728
}
2829

29-
private void Control_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
30-
{
31-
32-
FindChildControl<Button>(Control, "DeleteButton");
33-
}
34-
public DependencyObject FindChildControl<T>(DependencyObject control, string ctrlName)
35-
{
36-
int childNumber = VisualTreeHelper.GetChildrenCount(control);
37-
for (int i = 0; i < childNumber; i++)
38-
{
39-
DependencyObject child = VisualTreeHelper.GetChild(control, i);
40-
FrameworkElement FrameElement = child as FrameworkElement;
41-
if (FrameElement == null) return null;
42-
43-
if ((FrameElement is Grid))
44-
{
45-
UIElement FrameElementChild = (FrameElement as Grid).Children[1];
46-
if (FrameElementChild is Grid)
47-
{
48-
UIElement CloseButton = (FrameElementChild as Grid).Children[6];
49-
if ((CloseButton as Button).Name == ctrlName)
50-
{
51-
(CloseButton as Button).Width = 0;
52-
(CloseButton as Button).Height = 0;
53-
}
54-
}
55-
return child;
56-
}
57-
else
58-
{
59-
DependencyObject nextLevel = FindChildControl<T>(child, ctrlName);
60-
if (nextLevel != null)
61-
return nextLevel;
62-
}
63-
}
64-
return null;
65-
}
30+
6631
}
6732
}

0 commit comments

Comments
 (0)