binding

Binding custom list object properties to textbox from code behind

喜你入骨 提交于 2020-01-06 09:04:01
问题 Student class public class Student { string name; List<SubjectInfo> subjectInfoList; .... } List<SubjectInfo> List can have different number of SubjectInfo objects for different students. SubjectInfo class public class SubjectInfo { string subjectCode; int marks; ... } I want to display student object detail on a window. Since List have different number of object count I generated these from code behind. int i = 10; foreach (SubjectInfo info in student.SubjectInfoList) { TextBox tb = new

WPF binding to custom control (textbox) not working

爱⌒轻易说出口 提交于 2020-01-06 08:52:15
问题 i wrote a simple custom control that inherits from textbox and uses a custom inputbox to enter text: class TextTextbox : TextBox { public string InputBoxTitle { get; set; } public string Input { get; set; } public TextTextbox() { PreviewMouseDown += MyTextbox_MouseDown; } private void MyTextbox_MouseDown(object sender, MouseButtonEventArgs mouseButtonEventArgs) { TextBox tb = (TextBox)sender; var dialog = new BFH.InputBox.InputBox(InputBoxTitle, Input); dialog.ShowDialog(); if (!dialog

WPF C# Change button content from child window

久未见 提交于 2020-01-06 08:23:06
问题 I'm developing a touchscreen app. I have a form with buttons with the content "new player" and then a keyboard with a textbox is shown for the user to enter his name. Now I need that when I close (or while inputting the name) the button from the parent window change the content to the name that the user typed. But I cant make a binding to the parent.. how can I do it?? 回答1: Are you implementing the Model-View-ViewModel pattern in your WPF application, or using databinding at all? You don't

ObservableCollection not updating my GridViewColumns (MVVM)

前提是你 提交于 2020-01-06 05:38:08
问题 Hi please could somebody help? I have a ListView which is bound to a ObservableCollection i.e StabCollection. The data displays perfectly. I have a couple of textboxes and a combo box to enable the user to edit the columns. When those textboxes are edited the values change in the gridview as expected however I am trying to achieve a cancel feature to revert changes back to the original. Manually changing the SelectedItem of StabCollection or changing the StabCollection[SelectedIndex] doesn't

Canvas with VisualBrush not rendering Image correctly

喜夏-厌秋 提交于 2020-01-06 05:05:24
问题 I've got a Canvas that I'm setting the Background property to a VisualBrush consisting of an Image. I'm data binding the Canvas' Width and Height to the Images' Width and Height. Here's the XAML: <Canvas x:Name="imageCanvas" ClipToBounds="True" Width="{Binding ActualWidth, ElementName=dataImage}" Height="{Binding ActualHeight, ElementName=dataImage}" Loaded="imageCanvas_Loaded" MouseMove="imageCanvas_MouseMove"> <Canvas.Background> <VisualBrush Stretch="Uniform"> <VisualBrush.Visual> <Image x

Bind DataGridColumns Header to DataContext of the window

本秂侑毒 提交于 2020-01-06 04:18:06
问题 I have a DataGrid and want to bind the Header -property to a property of my windows DataContext but I did not get it working. Binding can be such a pain as (for me) it is never clear which context this has when simply using Binding . I know that the "Context" in the Binding={} is a single element of the DataGrid s ItemsSource . But what is the "Context" for Header={Binding ???} ? I've already tried: Header="{Binding Path=DataContext.MyProperty, RelativeSource={RelativeSource Self}} Header="

Xcode - Bind textfield to element of a Swift dictionary

懵懂的女人 提交于 2020-01-06 04:14:07
问题 I did bind a textfield to a Swift dictionary value via interface builder. In the textfield the correct value is pulled from the dictionary and displayed in the textfield. When I change the value of the element in the dict via myDict["Textfield1"] = "New value" the change is not visible in the textfield. When I do bind the value of the textfield to a property of a class, any change to this property is instantly visible in the textfield. Am I missing something? Thanks! 回答1: So basically, it won

JavaFx element not binding to controller variable on fx:id [duplicate]

不羁的心 提交于 2020-01-06 03:37:26
问题 This question already has answers here : JavaFX FXML controller - constructor vs initialize method (3 answers) Closed 3 years ago . This is likely pilot error, but the FXML attribute is not binding to the controller class on fx:id. I've whittled it down to a trivial example, but still "no joy". What am I overlooking? FXML file... <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.BorderPane?> <BorderPane fx:id="mainFrame" maxHeight="

WPF “static” binding in a List

无人久伴 提交于 2020-01-06 02:29:05
问题 I have a problem with a binding in a List. I have a List of objects. This List is bound to a ListBox. Of every object in my List I can open a ContextMenu: <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Header="First" IsEnabled="{Binding FirstEnabled}"/> <MenuItem Header="Second" IsEnabled="{Binding SecondEnable}"/> </ContextMenu> </Setter.Value> </Setter> </Style> </ListBox.ItemContainerStyle> In the code

Using Excel VBA to change PowerPoint Slide Size - Late Binding

安稳与你 提交于 2020-01-05 21:08:11
问题 I'm new-ish to VBA and brand new to StackOverflow, so please forgive any breaches of etiquette. I have a project to create a tool using Excel VBA that will allow the user to identify a source Excel file and then copy the print area of every worksheet in the Excel file into a slide in a newly created PowerPoint presentation. I have to use late binding because I can't assume the users of the tool will all be using the same versions of the Microsoft Office products, or that they will have