我需要使用相同的页面来更新我的详细信息..任何人都可以帮我设计它..
以下是我添加数据的XAML设计代码..
<Grid x:Name="ContentPanel" Margin="12,157,12,4" Grid.RowSpan="2">
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,67,0,0" TextWrapping="Wrap" Text="Name" VerticalAlignment="Top" Width="65"/>
<TextBox x:Name="txt_name" HorizontalAlignment="Left" Height="73" Margin="121,42,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" BorderThickness="0" InputScope="PersonalFullName"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,115,0,0" TextWrapping="Wrap" Text="Address" VerticalAlignment="Top" Width="75"/>
<TextBox x:Name="txt_address" HorizontalAlignment="Left" Height="78" Margin="121,110,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" BorderThickness="0" InputScope="PostalAddress"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,197,0,0" TextWrapping="Wrap" Text="City" VerticalAlignment="Top" Width="65"/>
<TextBox x:Name="txt_city" HorizontalAlignment="Left" Height="73" Margin="121,178,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" BorderThickness="0" InputScope="AddressCity"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,259,0,0" TextWrapping="Wrap" Text="State" VerticalAlignment="Top" Width="65"/>
<TextBox x:Name="txt_state" HorizontalAlignment="Left" Height="73" Margin="121,237,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" BorderThickness="0" InputScope="AddressCountryShortName"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,324,0,0" TextWrapping="Wrap" Text="Country" VerticalAlignment="Top" Width="75"/>
<TextBox x:Name="txt_country" HorizontalAlignment="Left" Height="73" Margin="121,302,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" BorderThickness="0" InputScope="AddressCountryName"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,386,0,0" TextWrapping="Wrap" Text="Web Site" VerticalAlignment="Top" Width="90"/>
<TextBox x:Name="txt_website" HorizontalAlignment="Left" Height="73" Margin="121,361,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="315" BorderThickness="0" InputScope="Url"/>
</Grid>
我的按钮点击代码为..
Organization neworganization=new Organization();
private void btn_add_organization_Click(object sender, RoutedEventArgs e)
{
neworganization = populateOrganizationDetails();
string organizationDetails = JsonConvert.SerializeObject(neworganization);
client.addNewOrganization(organizationDetails);
NavigationService.Navigate(new Uri("/HomePage.xaml", UriKind.Relative));
}
populateOrganizationDetails()
private Organization populateOrganizationDetails()
{
neworganization.name = txt_name.Text;
neworganization.address = txt_address.Text;
neworganization.city = txt_city.Text;
neworganization.country = txt_country.Text;
neworganization.website = txt_website.Text;
neworganization.state = txt_state.Text;
neworganization.region = txt_city.Text;
return neworganization;
}
任何请帮助我设计页面以更新同一页面的详细信息..我会更感谢...
答案 0 :(得分:0)
我完成了我的任务,在这里我更新了我的示例代码..
<Grid x:Name="ContentPanel" Margin="12,157,12,4" Grid.RowSpan="2">
<ListBox x:Name="editorg" Height="579" Width="456" ItemsSource="{Binding Organization}">
<TextBlock x:Name="name_txt" HorizontalAlignment="Left" Height="34" Margin="0,78,0,0" TextWrapping="Wrap" Text="Name" VerticalAlignment="Top" Width="100" FontFamily="Segoe UI Semibold" FontSize="22" IsHitTestVisible="True" />
<TextBox x:Name="txtbx_name" HorizontalAlignment="Left" Height="70" Margin="100,50,0,0" TextWrapping="Wrap" Text="{Binding name,Mode=TwoWay}" VerticalAlignment="Top" Width="333" FontFamily="Segoe UI Semibold" FontSize="18" InputScope="Default" IsHitTestVisible="True" AcceptsReturn="True" />
<TextBlock Name="Address_txt" HorizontalAlignment="Left" Height="30" Margin="0,148,0,0" TextWrapping="Wrap" Text="Address" VerticalAlignment="Top" Width="100" FontFamily="Segoe UI Semibold" FontSize="18" />
<TextBox x:Name="txtbx_address" HorizontalAlignment="Left" Height="68" Margin="100,118,0,0" TextWrapping="Wrap" Text="{Binding address,Mode=TwoWay,UpdateSourceTrigger=Explicit}" VerticalAlignment="Top" Width="333" FontFamily="Segoe UI Semibold" FontSize="18" InputScope="AddressStreet"/>
</Listbox>
</Grid>