binding

Stop ampersand from being turned into a mnemonic/accelerators for Windows Forms binding [duplicate]

情到浓时终转凉″ 提交于 2019-12-23 20:43:50
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Enter “&” symbol into a text Label in Windows Forms? On a screen with label controls bound to user-filled properties, I'm getting underlined characters (mnemonics) on the label because the underlying data contains ampersands. For example, if the bound property contains "A&B Trucking", then the label shows as "AB Trucking" with the B underlined. Alt-B on the keyboard would focus that label. How do you prevent

Binding to ColumnDefinition.ActualWidth returns 0

青春壹個敷衍的年華 提交于 2019-12-23 20:37:00
问题 Paste this into Cider. <Grid x:Name="Grid"> <Grid.ColumnDefinitions> <ColumnDefinition x:Name="ColumnDefinition"/> </Grid.ColumnDefinitions> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Text="{Binding ActualWidth, ElementName=Grid}"/> <TextBlock Text="{Binding ActualWidth, ElementName=ColumnDefinition}"/> </StackPanel> </Grid> Now, run it. The second TextBlock shows 0, but shouldn't, right? Workaround? 回答1: No, you didn't. ColumnDefinition does have an

What kind of controls should I use in Windows Phone 7 to make a “star” control

情到浓时终转凉″ 提交于 2019-12-23 20:32:51
问题 I show some items from the database in the list and I want the user to be able to mark some of them as favorites. The best way would be to show some star icon for user to click on which then would turn into slightly different star to indicate that the item is now favorite. What controls should I use for those stars? Could I bind them to some boolean property of the item? 回答1: You can also use vector graphics to achieve this without using png icons. I created this style a while a go, basically

Binding does not update usercontrol property correctly MVVM

与世无争的帅哥 提交于 2019-12-23 19:41:16
问题 Edit: Old code removed I place it on my MainWindow.xaml <SpinTextBlock:SpinTextBlock Text="{Binding Path=DataContext.WelcomeTitle, ElementName=Window,UpdateSourceTrigger=PropertyChanged}" Height="60" Width="40" x:Name="TextBlock"/> And bind it to a property in MainViewModel.cs public string WelcomeTitle { get { return _welcomeTitle; } set { if (_welcomeTitle == value) { return; } _welcomeTitle = value; RaisePropertyChanged(WelcomeTitle); Dispatcher.CurrentDispatcher.BeginInvoke( new Action

SLF4J and Log4j 2 binding Maven dependency

♀尐吖头ヾ 提交于 2019-12-23 19:14:23
问题 Hopefully a simple question but My google foo is failing me - I've got a maven project where we're using SLF4J with Log4J 1.2 bindings. We now want to move to Log4j 2 particularly for the performance improvement - however, I can't for the life of me find the maven dependency for the log4j 2.0 binding. I've found some notes at http://logging.apache.org/log4j/2.x/log4j-slf4j-impl/ but no mention of any dependency info. I'm also slightly confused by the fact there's apparently two ways to put

v-bind error:v-bind' is an undeclared prefix

☆樱花仙子☆ 提交于 2019-12-23 19:09:51
问题 I'm working in asp.net with Orckestra CMS (before Composite) and Razor Templates and trying to use Vue framework. All is fine when using {{option.text}} <select class="form-control" id="myExample1"> <option v-for="option in options">{{option.text}}</option> </select> But when I insert v-bind attribute, the page is broken: <select class="form-control" id="myExample1"> <option v-for="option in options" v-bind:value="option.value">{{option.text}}</option> </select> Rendering page fail and show

jQuery, AJAXed content losing it's bind

[亡魂溺海] 提交于 2019-12-23 18:53:05
问题 So imagine this scenario, I have a list and it has a bit of pagination going on, when the user clicks next, the link is hijacked by jQuery, it uses the $.ajax function (of which I've provided below) to go and get the next page contents and display them in the original container. This includes the pagination links as well as we want them to update too. The first page change works fine, but at this stage we've lost the bind between our link element and our jQuery rule: $('#paging a').click

Using Hashtable as DataContext (for WPF/XAML Binding)

风流意气都作罢 提交于 2019-12-23 17:53:16
问题 In code I have a Hashtable named MyHashtable . This Hashtable contains an element with key= "Value" , value= 3 . I'm currently trying to bind this value to a textbox. This is my XAML code: <TextBlock Margin="4" Text="{Binding MyHashtable[Value]}" /> <TextBlock Margin="4" DataContext="{Binding MyHashtable}" Text="{Binding [Value]}" /> Q: Why does the second binding not work, while the first binding works just great? For the second binding I have tried other bindings for the text, such as:

Advice on using the Dispatcher Priority and Binding

一曲冷凌霜 提交于 2019-12-23 17:35:57
问题 In my application I'm using the idle-time of the UI thread to offload expensive operations as described by MSDN article on the WPF Threading Model. GenerateDataAction = () => { GenerateData(); }; Dispatcher.BeginInvoke(GenerateDataAction, DispatcherPriority.Render, null); In the GenerateDate() method I access an MSSQL database, process the data in, and update bindings on the viewmodel. I have noticed since implementing this that some binding fail to update properly or not at all. I have check

WPF C# how to create THIS binding in code?

倖福魔咒の 提交于 2019-12-23 16:51:06
问题 I wonder, how to create this binding, since Line.X2 IS NOT dependency property! :( <Line Y1="0" X1="0" Y2="0" Stroke="Blue" StrokeThickness="3" Margin="0 -2 0 -2" X2="{Binding Path=RenderSize.Width, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}}"/> 回答1: Line.X2 is a dependency property so you can do this in the normal way: myLine.SetBinding(Line.X2Property, new Binding("RenderSize.Width") { RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor,