1. 程式人生 > >WPF XAML繫結xml

WPF XAML繫結xml

<Window x:Class="UpgradeBuilder.UI.PackageModifyUI"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="http://schemas.microsoft.com/wpf/2008/toolkit"
        xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:ui="clr-namespace:UpgradeBuilder.UI"
        Title="更新包版本管理" Top="200" Left="400" Height="400" Width="500">
    <!--繫結-->
    <Window.Resources>
        <XmlDataProvider x:Key="AllItem" Source="../PackageConfig.xml"  XPath="Mysoft.Config"/>
    </Window.Resources>
    <Grid Margin="5" >
        <Grid.RowDefinitions>
            <RowDefinition Height="70"/>
            <RowDefinition Height="240"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" DataContext="{Binding Source={StaticResource AllItem}, XPath=PackageCollection}">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Label Content="更新包版本:" Grid.Row="0" Grid.Column="0" Margin="2,2,2,2"/>
            <TextBox Name="PackageVersionNameBox" Grid.Row="0" Grid.Column="1" Height="25" Margin="2,2,2,2" Text="{Binding XPath=PackageVersionName}" IsReadOnly="False"/>
        </Grid>
    </Grid>
</Window>

相關推薦

WPF XAMLxml

<Window x:Class="UpgradeBuilder.UI.PackageModifyUI" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sc

WPF: ListBoxxml資料

    繼承自IEnumerable介面的各種集合都可以作為ListBox控制元件的資料來源。WPF中的XmlDataProvider 提供了一種將xml檔案作為集合資料來源的便捷方式,只要所定義的xml格式正確沒有拼寫錯誤,XPath路徑指定正確都可以繫結成功。 下面定義

WPF資料-用XAML

用XAML繫結          WPF元素不僅是資料繫結的目標,它還可以是繫結的源。可以把一個WPF元素的源屬性繫結到另一個WPF元素的目標屬性上。 ElementName指向繫結源,Path指向源屬性 此處CheckBox為繫結源,IsChecked為源屬性,Labe

菜鳥做wpfxml使遇到很多問題,跪求解

跪求各位高手,菜鳥在做wpf繫結xml操作,遇到以下難題,求各位高手:wpf 繫結 xml 為資料來源的圖片繫結(及佈局)方法,單擊按鈕改變屬性:如下圖單擊Button,改變ID、Name、Age、Sex中的任何一個或幾個屬性值,急求,謝謝

WPF---資料之PasswordBox(八)

一、概述 眾所周知,繫結的源既可以是依賴屬性也可以是普通的CLR屬性,而繫結的目標只能是依賴屬性。 控制元件PasswordBox的Password屬性不是依賴屬性,不可以作為繫結的目標與後臺資料進行繫結,而在MVVM模式中,前臺和後臺的繫結是經常需要的,為了達到這種目的,我們可以藉助附加屬性來實現Pas

WPF Bind

原文: WPF Bind 繫結 用過WPF的童鞋應該都是知道WPF最好用的就是這個 綁定了,這裡簡單記錄一下關於繫結的。 /// <summary> /// 繫結元素的屬性到一個物件的屬性中 /// </summary&g

WPF資料小結

目錄   1、資料繫結 1.1 定義 1.2 繫結語法 1.2.1 標記擴充套件使用 1.2.1 物件元素語法 1.3 繫結資料來源型別 1.4 繫結資料流方向 1.5 繫結到集合 2、資料轉換介面 2.1 單值轉換介面IValueConve

WPF ComboboxList

在WPF中若需要繫結List<string>物件到ItemsSource屬性,具體操作步驟: 1 生成水果類 Fruits.cs namespace WpfApp1 { public class Fruits { public Frui

WPF ListBox圖片列表

1.圖片列表定義 圖片列表使用BindingList而不使用List,因List未實現繫結相關聯操作,在使用者改變列表時無法更改ListBox中的內容。 工程新增System.ComponentModel;引用來引入BindingList。 2.XAML繫結程式碼 <Lis

MyBatis不能xml:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

臨睡前解決了一個問題: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 檢查以下配置: 1:檢查xml檔案所在的package名稱是否和interface對應的packa

WPF Listview資料發生改變後前端沒有更新

前端沒有更新的原因: 1.將控制元件與列表繫結 ICMask.ItemsSource = _poppingWordList; 2.在更新繫結資料時 _poppingWordList = newWordList; 因為List是引用,這樣是將_poppingWordList的指向的列表更

WPF資料---雙向

定義繫結型別時,實現/引用INotifyPropertyChanged介面 public class StudentData:INotifyPropertyChanged { private int id; private string name; pu

WPF網格控制元件並控制控制元件是否可讀

<DataGridTemplateColumn Width="100" Header="實測值"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel HorizontalAlignment

WPF datagridlist容器無法更新顯示

Xml程式碼片段: <DataGrid x:Name="DataGridGap_y"  RowHeaderWidth="0"  AlternationCount="2" Grid.Row="1" Grid.Column="0"   AutoGenerateColumn

WPF資料-簡單物件的

繫結自定義的資料類物件 在xaml程式碼中,Binding標記擴充套件中僅定義了Path屬性,將它繫結到StudentData類的屬性上。不需要定義源物件,因為通過指定DataContext類定義源物件。 DataContext是一個依賴屬性,它用基於Framewro

XAML 和結構體不得不說的問題

遇見一個問題 如果用一個結構體struct。再用一個ListView,然後使用繫結。 <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xam

wpf怎麼多個值,多個控制元件

最近有不少wpf新手問wpf的命令怎麼繫結多個控制元件,很多人為此絞盡腦汁,網上的答案找了也沒找到靠譜的,其實用MultiBinding就可以了。從.net 3.0版本開始,就支援MultiBinding 關於MultiBinding的說明: https://docs.microsoft.com/zh-c

WPF 資料詳解。。。

資料繫結 控制元件之間的繫結 繫結源 source  資料提供者 繫結物件 target  接受資料的物件,被繫結的物件 對 繫結物件 進行資料繫結,將其的屬性,和繫結源的某個屬性進行繫結 純 xaml 繫結 < Grid > < T

WPF資料

雖然很多人都知道WPF提供了很強大的資料繫結功能,但是並不知道怎麼去學習。我也是剛剛接觸這個,剛開始的時候看到了MSDN提供的文件和文章裡面的WPF介紹,裡面雖然有詳細的講解和一個提供的拍賣程式程式碼,可是對於初學的我來說還是看得頭大,結果看了一個下午也明白具體該怎麼用。

wpf comboboxdictionary

1 Dictionary<int, string> or Dictionary<double, string> Dictionary<double, string> TimeOutDictionary = new Dictionary&l