cost 332 ms
在 WPF 應用程序中使用 RelativeSource 綁定(不是 ElementName)訪問前一個兄弟元素?

[英]Access a previous sibling element using RelativeSource binding (not ElementName) in WPF Application?

我正在嘗試訪問直接位於目標元素之前的同級元素的屬性。 這是我必須在我的應用程序中多次復制的東西,所以如果可能的話,我寧願使用可重現的東西(不是 elementName)。 有任何想法嗎? ...

無法從 TabItemHeaderTemplate 中找到 DataGrid.ItemsSource 的正確相對綁定語法

[英]Trouble finding correct relative binding syntax for DataGrid.ItemsSource from TabItemHeaderTemplate

我的控件中有一個 TabControl,每個選項卡中都有一個 DataGrid。 我正在使用模板設置選項卡 header 的樣式。 我想綁定到選項卡上的 DataGrid.ItemsSource 以便能夠應用過濾器以將圖像添加到 TabItem 以指示狀態。 下面是我的 VisualTree,帶有指 ...

WPF - TextBlock 中的工具提示使用 TextBlock 中的 Text 屬性

[英]WPF - ToolTip in TextBlock that use the Text Property from the TextBlock

我們的應用程序中有許多 TextBlocks,其中許多必須有工具提示。 工具提示通常應顯示為與TextBlock.Text屬性相同。 此外,如果 TextBlock.Text = ""或null ,則不應顯示工具提示。 所以我們在很多地方都有這個解決方案: 注意: 我必須在每個需要具有此功能的 To ...

在 WPF 中使用 RelativeSource FindAncestor 時出錯

[英]Error Using RelativeSource FindAncestor in WPF

我確實有一個 Window(DataContext VM)和一個 Listview(VM 中的 ItemSource Observable List)數據來自 sqlite DB,Observable List 是模型類型,代表居民。 每個居民都應該有一個“簽入”或“簽出”按鈕,對他們來說,我的虛擬 ...

綁定到 ControlTemplate onwer 的屬性

[英]Bind to ControlTemplate onwer's property

我有一個 ControlTemplate,我將其用作 Validation.ErrorTemplate: 我正在嘗試使用 TemplatedParent 將 ControlsTemplate 的 TextBlock 的寬度綁定到 TextBlock 的 ActualWidth,但它無法正常工作。 任 ...

綁定到窗口的標題並不總是有效

[英]Binding to the Title of a Window does not always work

我需要將兩個TextBlock數據綁定到Window.Title屬性。 第一個通過以下方式工作: 但是第二個沒有(它深深地嵌套在按鈕ToolTip )。 如何更改第二個以使其也顯示Window的Title ? ...

如何從 Xamarin Forms 中的 DataTemplate 條目 TextChanged 事件調用命令?

[英]How to call Command from DataTemplate Entry TextChanged Event in Xamarin Forms?

在 CollectionView 中使用 DataTemplates...我可以從這樣的按鈕調用 ViewModel 的命令: 或者像這樣的手勢: 那么,為什么我不能像這樣從 Entry 的 TextChanged 事件中調用該命令? EventToCommandBehavior的代碼在未在 D ...

相對來源從未調用過

[英]RelativeSource never called

我想將后面代碼中的命令綁定到UserControl.Resources用戶控制按鈕( ICommand ) 所以我用RelativeSource寫了一段代碼。 但它沒有用。 我嘗試使用轉換器進行調試來解決這個問題。 但即使這也沒有被調用。 這是我制作的代碼。 如果我錯了,請告訴我。 謝謝你 ...

RelativeSource 不使用子屬性工作

[英]RelativeSource not working using child property

我不明白這些示例與第一個綁定的問題/區別: (CustomTheme、ItemFormatting 和 FontNormal 是 DependencyObjects) 這個錯誤進一步下降: 這絕對等同於第一個並且有效: 這不是我想要實現的,但有效: 我不明白為什么我在第一個錯誤上得到這個 outp ...

在代碼隱藏中獲取 WPF RelativeSource 綁定的值

[英]Getting the value of a WPF RelativeSource binding in codebehind

我正在嘗試翻譯此 XAML 代碼: 進入這個 C# 代碼: 我的 PropertyPathHelper 的實現(從另一個線程修改)class 如下: 我的 Binding 聲明不正確,或者我的 PropertyPathHelper 實現不正確,但我不知道哪個,因為在運行時,“var value”作為 ...

如何確定 WPF 中 RelativeSource 的 AncestorLevel?

[英]How do I determine AncestorLevel for RelativeSource in WPF?

在使用相當標准的 MVVM 模式的 WPF 應用程序中,我需要從DataTable中的一行(即在可視化樹的深處)綁定到整個 window 的數據上下文。 我假設這樣做的唯一方法是使用Mode=RelativeSource ,但它要求我指定AncestorLevel 。 如何確定AncestorLe ...

綁定返回 RelativeSource object 而不是綁定指向的那個

[英]Binding returns RelativeSource object instead the one pointed by the binding

我必須將DataGrid中列的Visibility屬性綁定到主用戶控件的屬性。 DataGrid位於用單獨的ResourceDictionary編寫的DataTemplate中。 我已經使用了這篇文章中描述的 ProxyFramework 元素技巧。 問題是代理元素內的綁定返回 System.Wi ...

使用 BindableLayout.ItemsSource 在 StackLayout 中進行命令綁定(使用 RelativeSourceExtension)

[英]Command-Binding (with RelativeSourceExtension) within a StackLayout using BindableLayout.ItemsSource

我正在嘗試使用 Xamarin.Forms 應用程序中的 BindableLayout.ItemsSource 將命令(使用 RelativeSourceExtension)綁定到 StackLayout 中的按鈕。 MyControl.xaml 的不工作版本: 不幸的是,該按鈕處於“非活動狀態 ...

Visual Studio 無法識別 Xamarin 項目中 xaml 中的 RelativeSource Self

[英]Visual studio does not recognise RelativeSource Self in xaml in Xamarin project

我在文檔中讀到以下示例應該在 Xamarin 項目中工作。 但是我的視覺工作室(最新版本 v2019)將“RelativeSource Self”部分標記為紅色,並給出以下編譯錯誤: 錯誤 XLS0414 找不到類型“RelativeSource”。 驗證您沒有缺少程序集引用並且所有引用的 ...

以App.xaml樣式WPF訪問用戶控件屬性

[英]Access user control property in App.xaml style WPF

我試圖通過模型中的屬性在我的可視筆刷(在App.xaml中定義)中設置Path的“ Stroke”屬性。 我在用戶控件的另一個控件模板中使用此樣式。 用戶控件資源中的樣式: 在App.xaml中定義的畫筆: 這里的問題是,我無法通過綁定在app.xaml中設置面刷的Str ...

將Converter綁定到xaml中的父資源

[英]Bind Converter to the parent resource in xaml

我有一個usercontrol1.xaml,其中定義了一個資源: 然后在用戶控件視圖2中,我要遇到這種情況: 我能夠鏈接到ItemSource的父控件,但是對於轉換器,我該怎么做? 我無法將資源定義從control1移動到control2。 在RadTileViewItem內 ...

從python資源根獲取資源

[英]Get resource from python resource root

我正在使用PyCharm IDE。 我將文件夾標記為資源根,並希望從其目錄中獲取文件,並且想知道這樣做的適當方法。 在Java中,您可以使用getClass()。getResource(“ / resourceName.extension”) 有沒有辦法以上述方式從python獲取 ...

WPF綁定到觸發器中Style的目標上的屬性

[英]WPF Bind to a property on the Style's target in Trigger

我希望在Button內部有一個GeometryDrawing ,當鼠標懸停在Button時,它會改變它的Geometry : 但是,它給了我這個錯誤 System.Windows.Data錯誤:4:無法找到綁定源,引用'RelativeSource FindAncestor,A ...

WPF MVVM-從祖先視圖模型綁定到屬性

[英]WPF MVVM - Bind to a property from an ancestor view model

我有一個類似於以下內容的視圖/視圖模型: 這些視圖中的每一個都綁定到適當的視圖模型。 我試圖將SomeCustomProperty綁定到CustomDialogView的視圖模型上的屬性。 做這個的最好方式是什么? 我嘗試了一些方法,其中最有前途的似乎是通過Relative ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM