This article is currently in the process of being translated into Arabic (~23% done).
If you are fluent in Arabic, then please help us - just point to any untranslated element (highlighted with a yellow left border - remember that images should have their titles translated as well!) inside the article and click the translation button to get started. Or have a look at the current translation status for the Arabic language.
If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.
Please help us by translating the following metadata for the article/chapter, if they are not already translated.
If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed. Please only submit an altered translation of a metadata item if you have good reasons to do so!
حتى الآن في هذا البرنامج التعليمي ، استخدمنا فقط عناصر التحكم المضمنة الموجودة في إطار عمل WPF. سوف تحصل على شوط طويل جدًا ، لأنها مرنة للغاية ويمكن تصميمها وقوالبها للقيام بأي شيء تقريبًا. ومع ذلك ، في مرحلة ما ، من المحتمل أن تستفيد من إنشاء عناصر التحكم الخاصة بك. في أطر عمل أخرى لواجهة المستخدم ، قد يكون هذا مرهقًا للغاية ، لكن WPF يجعل الأمر سهلاً للغاية ، حيث يقدم لك طريقتين <لإنجاز هذه المهمة: > سيطرة المستخدم وسيطرات مخصصة
A WPF UserControl inherits the UserControl class and acts very much like a WPF Window: You have a XAML file and a Code-behind file. In the XAML file, you can add existing WPF controls to create the look you want and then combine it with code in the Code-behind file, to achieve the functionality you want. WPF will then allow you to embed this collection of functionality in one or several places in your application, allowing you to easily group and re-use functionality across your application(s).
A Custom control is more low-level than a UserControl. When you create a Custom control, you inherit from an existing class, based on how deep you need to go. In many cases, you can inherit the Control class, which other WPF controls inherits from (e.g. the TextBox), but if you need to go even deeper, you can inherit the FrameworkElement or even the UIElement. The deeper you go, the more control you get and the less functionality is inherited.
The look of the Custom control is usually controlled through styles in a theme file, while the look of the User control will follow the look of the rest of the application. That also highlights one of the major differences between a UserControl and a Custom control: The Custom control can be styled/templated, while a UserControl can't.
Creating re-usable controls in WPF is very easy, especially if you take the UserControl approach. In the next article, we'll look into just how easy it is to create a UserControl and then use it in your own application.