Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF DataContext source
    primarykey
    data
    text
    <p>I populate my controls by binding them to a class, as in this example:</p> <pre><code>HttpResponseMessage response = await client.GetAsync("/api/Customer/" + txtNumber.Text); response.EnsureSuccessStatusCode(); var customer = await response.Content.ReadAsAsync&lt;Customer&gt;(); this.DataContext = customer; </code></pre> <p>This works fine.</p> <p>I also use the same controls as search criteria, ie. the data the user enters in any controls should be collected and sent back to the server to query the db.</p> <p>Is there a simple way to collect this data or do I have to loop through the controls and do the collection myself?</p> <p>This is the XAML:</p> <pre><code>&lt;Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Model="clr-namespace:Server.DTO;assembly=Server.DTO" mc:Ignorable="d" x:Class="Client.Forms.Reference.DataForm" Title="Preisstufe" Height="346" Width="459" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" ScrollViewer.VerticalScrollBarVisibility="Disabled" ResizeMode="NoResize" Loaded="Window_Loaded"&gt; &lt;DockPanel LastChildFill="True"&gt; &lt;StatusBar x:Name="statusBar" DockPanel.Dock="Bottom" Height="20"&gt; &lt;StatusBarItem x:Name="statusBarItem" Content="" Height="20" VerticalAlignment="Top"/&gt; &lt;/StatusBar&gt; &lt;Grid&gt; &lt;Grid.Background&gt; &lt;SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlLightColorKey}}"/&gt; &lt;/Grid.Background&gt; &lt;Canvas&gt; &lt;Label Content="Number:" HorizontalAlignment="Left" Margin="87,33,0,0" VerticalAlignment="Top"/&gt; &lt;TextBox x:Name="txtNumber" HorizontalAlignment="Left" Height="24" Margin="185,36,0,211" Text="{Binding Number, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="76" KeyDown="txtNumber_KeyDown"/&gt; &lt;Label Content="Description:" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="87" Canvas.Top="62"/&gt; &lt;TextBox x:Name="txtDescription" HorizontalAlignment="Left" Height="24" Margin="185,64,0,183" Text="{Binding Description, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="236"/&gt; &lt;Label Content="Abbr:" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="87" Canvas.Top="91"/&gt; &lt;TextBox x:Name="txtAbbr" HorizontalAlignment="Left" Height="24" Margin="185,93,0,154" Text="{Binding Abbr, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="75"/&gt; &lt;/Canvas&gt; &lt;/Grid&gt; &lt;/DockPanel&gt; &lt;/Window&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload