binding

How do I set the default text of a textbox with a Binding of RelativeSource Self

萝らか妹 提交于 2019-12-24 11:24:33
问题 On the initial page load, I am setting it up so that the form is ready to enter a new record. For some custom data validators, I set the binding to itself. My question is how can I set the default text to something? <TextBox> <TextBox.Text> <Binding RelativeSource="{RelativeSource Self}" Path="Text" UpdateSourceTrigger="LostFocus" > <Binding.ValidationRules> <validators:MyCustomValidators /> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox> 回答1: Add an event handler on the

jquery autocomplete on element retrieved w/ ajax

我的梦境 提交于 2019-12-24 11:22:58
问题 I am using a simple jquery autocomplete script to search for colleges in a text field. This same script works on another page. On the page in question though, I retrieve the form with an ajax call and it's not working. Did I forget something or is there an issue binding the autocomplete event to the when it is inserted in the DOM? AJAX Markup: <input type="text" class="alumni" name="alumni0" id="alumni0" value="Academy College"> Script: <script src="http://ajax.googleapis.com/ajax/libs

Wpf text box not updated from view model

♀尐吖头ヾ 提交于 2019-12-24 11:18:03
问题 I have a property in my view model which returns a constant under some conditions. which is implemented similiar to this: class Tmp : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public String Text { get { return "testing"; } set { PropertyChanged(this,new PropertyChangedEventArgs("Text")); } } } so the property Text alwasys returns "testing". I bound this to a text box like : <TextBox Text="{Binding Path=Text, Mode=TwoWay, UpdateSourceTrigger

Binding to a method in DataContext

半腔热情 提交于 2019-12-24 10:48:11
问题 Is it possible to use a method of the DataContext in a binding? E.g. the signature public bool ProjectIsActive(int number) [note: not static], can it be declared in a binding? EDIT: Following the suggestion of ywm and Sheridan I tried adding a resource to my Window with name _this. I changed the signature to public bool ProjectIsActive(object number) . <Window.Resources> <ObjectDataProvider x:Key="ProjectIsActive" ObjectInstance="_this.DataContext" MethodName="ProjectIsActive">

C# WPF Combobox TextElement.Foreground Binding

…衆ロ難τιáo~ 提交于 2019-12-24 10:18:23
问题 I wish to link the TextElement.Foreground property of my combo box to the variable : "ALV_COULEUR" of my object : "tValeur" . I note in output that it does not find variable ALV_COULEUR ... System.Windows.Data Error: 40 : BindingExpression path error: 'ALV_COULEUR' property not found on 'object' ''Attribut' (HashCode=35307513)'. BindingExpression:Path=ALV_COULEUR; DataItem='Attribut' (HashCode=35307513); target element is 'ComboBox' (Name=''); target property is 'Foreground' (type 'Brush')

WPF: multiple controls binding to same property

最后都变了- 提交于 2019-12-24 09:59:48
问题 Hello I'm trying to change several controls' property according to some environment variables and i want to avoid creating a property for each control in the datacontext, so i thought using a converter which sets the property according to control name. Goal is to use one property for all controls: <Grid.Resources> <local:NameToStringConverter x:Key="conv" /> </Grid.Resources> <TextBlock Name="FordPerfect" Text="{Binding ElementName="FordPerfect" Path=Name, Converter={StaticResource conv},

C# WPF - Listview Binding not working

北城余情 提交于 2019-12-24 09:48:57
问题 I have been trying to create a window in WPF and bind a listview to a list of objects, but I can't get the objects in the list to display in the listview. Here is the XAML of the window: <Window x:Class="WpfApplication.window_ManageInstruments" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="window_ManageInstruments" Height="400" Width="600" WindowStartupLocation="CenterOwner"> <Grid> <Grid.RowDefinitions>

Next step to Make Binding for embedded framework for Xamarin.iOS?

孤者浪人 提交于 2019-12-24 09:39:22
问题 I'm trying to use Native iOS framework from BLE chip bender(nordic) on Xamarin iOS. this framework (iOS Native - swift) : https://github.com/NordicSemiconductor/IOS-DFU-Library/tree/master/documentation I made a fat framework with those iOS library. And I looked this doc. https://developer.xamarin.com/guides/ios/advanced_topics/embedded_frameworks/ I imported it as Native framework on Xamarin.iOS project. And I want to use it. Below code is from that I used when i'm making iOS native app. I

Binding listview on a page control using template in Windows 8

点点圈 提交于 2019-12-24 08:59:08
问题 For some reason, my template is not getting used in the binding of data. I'm using Visual Studio's "Navigation App" project type for Windows 8 app. When I run it, each item just gets filled with the full json string. Similar to binding without using any templates at all. home.js : var dataList = new WinJS.Binding.List(); var publicMembers = { itemList: dataList }; WinJS.Namespace.define("VideosData", publicMembers); (function () { "use strict"; WinJS.UI.Pages.define("/pages/home/home.html", {

What's wrong with my WPF Binding (in C# code)?

点点圈 提交于 2019-12-24 08:57:59
问题 I didnt use WPF for a long time so I'm quite sure this is an easy question for most of you but here is my xaml code : <Grid> <ProgressBar Name="Progress" Width="200" Height="20" Minimum="0" Maximum="100" Margin="10"/> </Grid> and here is the C# code : namespace WpfApplication1 { public partial class MainWindow : Window, INotifyPropertyChanged { private int _MyInt; public int MyInt { get { return _MyInt; } set { _MyInt = value; RaisePropertyChanged("MyInt"); } } public MainWindow() {