Find all controls in WPF Window by type
I’m looking for a way to find all controls on Window by their type, for example: find all TextBoxes, find all controls implementing specific interface etc. 17 Answers 17
I’m looking for a way to find all controls on Window by their type, for example: find all TextBoxes, find all controls implementing specific interface etc. 17 Answers 17
What I am trying to do is show a window, that does not explicitly have a height/width, (both values omitted or set to Auto). I was guessing that the window would find out its size by auto – calculating all contained usercontrols sizes, but this doesn’t actually work! Instead I get a big window with … Read more
What control type should I use – Image, MediaElement, etc.? 19 Answers 19
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I’m a C#/Windows Forms programmer with more than 5 years experience. I’ve been investigating WPF using the MVVM (Model-View-ViewModel) design pattern. I have searched the Internet for tutorials. I … Read more
If I have such string in XAML: Storyboard.TargetProperty=”Margin” From=”1,2,3,4″ To=”0,0,0,0″ What is Top Bottom Right and Left? 1- right 2- top 3- left 4 – bottom Is that right? 4 Answers 4
I’m currently using the TextBlock below to bind the value of a property named Name: <TextBlock Text=”{Binding Name}” /> Now, I want to bind another property named ID to the same TextBlock. Is it possible to bind two or more values to the same TextBlock? Can it be done with simple concatenation, like Name + … Read more
Do you know any controls inherited from the ItemsControl that have horizontal orientation of items? 5 Answers 5
In the MVVM pattern for WPF, handling dialogs is one of the more complex operations. As your view model does not know anything about the view, dialog communication can be interesting. I can expose an ICommand that when the view invokes it, a dialog can appear. Does anyone know of a good way to handle … Read more
How do I assign vertical center alignment to the text inside a TextBlock? I found TextAlignment property but it is for horizontal text alignment. How do I do it for vertical text alignment? 16 Answers 16
If I call SelectAll from a GotFocus event handler, it doesn’t work with the mouse – the selection disappears as soon as mouse is released. EDIT: People are liking Donnelle’s answer, I’ll try to explain why I did not like it as much as the accepted answer. It is more complex, while the accepted answer … Read more