| WPF-Question-Answers-11-20 | WPF-Question-Answers-31-40 | |
WPF (Windows Presentation Foundation) Question Answers - (21–30) |
By default, TextBox.Text has an UpdateSourceTrigger value of LostFocus. This means the source does not get updated until the TextBox loses focus.
To update the source as you type, set the UpdateSourceTrigger property to PropertyChanged:
<TextBox Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}" />
Note: For most properties, UpdateSourceTrigger defaults to PropertyChanged, but for TextBox.Text it defaults to LostFocus.
The layout system completes two passes for each child: a measure pass and an arrange pass.
Layout is recursive, leading to elements being sized, positioned, and drawn onscreen.
Two: Window and NavigationWindow. NavigationWindow derives from Window and adds navigation capability:
object, ItemsSource expects IEnumerable.FrameworkElement, ItemsSource by ItemsControl.No. x:Static is a markup extension that retrieves values from static members on classes, unlike data binding which binds to dynamic data sources.
Example in XAML:
<DataGrid ItemsSource="{Binding Customers}" SelectionMode="Extended" SelectionUnit="Cell" />
In C# code:
MyGrid.ItemsSource = ds.Tables["Table"].AsEnumerable(); MyGrid.ItemsSource = ds.Tables["Table"].DefaultView; MyGrid.ItemsSource = new DataView(ds.Tables["Table"]);
Resources are reusable WPF objects (like styles, brushes, images). They can be declared in:
Types: StaticResource, DynamicResource.
Styles allow sharing of properties, resources, and event handlers across controls.
They are declared in Resources and obey the same scoping rules.
Styles can inherit from other styles (via BasedOn).
WPF provides two main templates:
| WPF-Question-Answers-11-20 | WPF-Question-Answers-31-40 | |