相关疑难解决方法(0)

如何在WPF XAML中使用嵌套类?

我正在重构示例中的代码:

排除技能等级后,与相应的变化
MainWindow.xaml

<local:Team>
  <local:Employee Name="Larry" Age="21">
    <local:Employee.Skills>
      <!--  local:Skills -->
       <local:Skills>
Run Code Online (Sandbox Code Playgroud)

MainWindow1.xaml.cs中:

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
namespace WpfApplication
{
  public class Skill
  {//I'd like to exclude class Skill having moved it into class Employee as nested one
    public string Description { get; set; }
  }

   public class Employee 
   {
    public string Name { get  ; set; }
    public int Age  { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf xaml nested-class

23
推荐指数
1
解决办法
2万
查看次数

如何绑定SQLite的完整响应?

我正在ListView我的C#文件中.但是,我想要添加我从sqlite获得的数据以及带有数据绑定的xaml文件,所以我仍然可以使用xaml编辑布局.因此,sqlite的每个响应都需要添加为label(<TextCell Text="{Binding Name}" />).

我的问题:如何将响应绑定GetCategoryByMenuID到TextCell Text="{Binding Name}"

xaml页面(CategoriePage.xaml):

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="AmsterdamTheMapV3.CategoriePage">
  <ListView x:Name="listView">
    <ListView.ItemTemplate>
      <DataTemplate>
        <TextCell Text="{Binding Name}" />
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)

后端/ C#(CategoriePage.xaml.cs):

namespace AmsterdamTheMapV3
{
    public partial class CategoriePage : ContentPage
    {

        public CategoriePage(String txt)
        {
            InitializeComponent();
            var layout = new StackLayout { Padding = new Thickness(5, 10) };
            int page = Int32.Parse(txt);
            this.Content = layout;

            var categories = App.Database.GetCategoryByMenuID(page);

            var datatemplate = new DataTemplate(() …
Run Code Online (Sandbox Code Playgroud)

c# sqlite wpf xaml xamarin.forms

6
推荐指数
1
解决办法
310
查看次数

标签 统计

c# ×2

wpf ×2

xaml ×2

data-binding ×1

nested-class ×1

sqlite ×1

xamarin.forms ×1