I have a form that is generated based on several DataTemplate elements. One of the DataTemplate elements creates a TextBox out of a class that looks like this:
public class MyTextBoxClass
{
public object Value { get;set;}
//other properties left out for brevity's sake
public string FormatString { get;set;}
}
I need a way to "...
I have an object tree which is included in a ResourceDictionary in my application. The root node of this object tree has an x:Key associated with it. I want to bind a control to a property of one of the nested items in this tree. How can I get access to a child element of a keyed ResourceDictionary to allow me to do this?
...
Hi All,
I have a comboBox inside a DataTemplate as below:-
<ComboBox x:Name="cboImages" Grid.Row="1" Grid.Column="1" SelectedItem="{Binding XPath=ImageName, Path=SelectedItem.Content, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True" >
<ComboBoxItem>Image1.jpg</ComboBoxItem>
<ComboBoxItem>Image2.jpg</ComboBoxItem>
<ComboBoxItem>Image3...
What I have is a class with static properties that I want to use as images. I would like the images to be configurable at run time but still have the defaults. So the Images class looks like:
package {
public class Images {
[Embed(source="/assets/Green-Light.gif")]
[Bindable]
public static var GreenLight:Class;
}
}
And now a custom c...
I've got an XIB window that I'm working with in Interface Builder. It has an NSScroller and 4 popups. The controller class has a float and 4 ints.
I bound the scroller to the float and the pupups to the ints, binding the value of the scroller and the selected index of the popups.
When I move the scroller, or change the popup selectio...
I want to compare two versions of various properties and bold one of them if it is not equal to the other. Since SL4 doesn't support MultiBinding I am binding the FontWeight to "." so that the entire data context is passed to the converter. I then use the converter parameter to specify which fields to compare within the converter. So f...
If you bind to a view-model property that is a nullable double (or int) how do you allow a user to specify nothing.
I'm looked into validation but I can't see how I could get that to help.
It seems like if a textbox is blanked out WPF sees it as an empty string and then doesn't put the into the vm proptery.
So 2 ways around it I ca...
I'm attempting to setup a MenuItem that will have a submenu of page numbers that can be selected. I want to bind the ItemsSource to a list of page numbers (actually to the PageCount with a converter creating the list) and then bind the IsChecked property of each MenuItem in the sub-menu to the PageIndex. My problem is with the second b...
I have a ListBox with an Explicit binding set to SelectedValue.
SelectedValue="{Binding Path=Property, UpdateSourceTrigger=Explicit}"
the ItemSource of ListBox is an ObservableCollection.
When I select an item of ListBox and press 'Enter' I update the property value in this way:
BindingExpression be = listBox.GetBindingExpression(Li...
I have this sample code:
<ControlTemplate Content="{Binding .}"/>
What does the point mean here relating to the binding?
...
Hey,
I try to built a DataGrid, and I want to bind one of the TextColums' Foreground property to a Date, so that it becomes red, if the Date is in the past.
Here the XAML:
<toolkit:DataGridTextColumn
Binding="{Binding Path=Prüfdatum, Converter={StaticResource TimestampToDateConverter}}"
Header="Prüfdatum"
Foreground="{Bind...
I have a list of Customer objects, which I've grouped on Country.
var query =
from c in ctx.Customers group c by c.Country
...
query is now an enumeration of groups (IQueryable<IGrouping<string, Customer>>), where each item of thie enumeration defines a group (IGrouping<string, Customer>).
I understand that IGrouping is: the...
I have a UserControl...
XAML:
<UserControl x:Name="ClientsListControl" ....... >
<Grid>
<ListBox Margin="10" DisplayMemberPath="Name"
Name="profilesListBox"
ItemsSource="{Binding ElementName=ClientsListControl, Path=Items}" />
</Grid>
</UserControl>
Code behind:
public partial class ClientsList : UserC...
In Tkinter I'm trying to make it so when a command is run a widget is automatically selected, so that a one may bind events to the newly selected widget.
Basically I want it so when I press a button a text widget appears. When it appears normally one would have to click the text widget to facilitate the running of events bound to the t...
My listbox is not displaying the items. The items are in a List<string>.
Here is the xaml:
<DockPanel Margin="10,10,10,10">
<DockPanel.Resources>
<local:MyErrors x:Key="myErrors"/>
</DockPanel.Resources>
<ListBox DockPanel.Dock="Top" ItemsSource="{StaticResource myErrors}" Height="300" Width="250" Margin="0,5,0,10" ...
Hi guys,
So I'm making a custom window template for my WPF application. The trouble I'm having is that I cannot access the Window Title property inside the template.
I tried this:
<TextBlock Text="{TemplateBinding Title}" />
And this:
<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title}" />
Ever...
This problem could be bad class design or ignorance - please bear with me:
I have 2 classes - Chip (which implements INotifyPropertyChanged and represents a single poker chip) and ChipSet, which implements INotifyPropertyChanged and has an ObservableCollection of Chip.
I have a Datagrid which is bound to the Chip ObservableCollection a...
Hi,
I am trying to bind a label 2 (or more!) fields in a dataset in Silverlight 4. I get a localized string out of a resource file and do a String.Format on it like so:
<TextBlock Name="lblTotals" Text="{Binding TotalItems, StringFormat='You need \{0\} items and \{1\} products.'}" />
This works fine with 1 item but there's no way of ...
Hi All,
I am trying to create a back button. So i am binding the navigationwindows backstack.
Code:
<Hyperlink Name="back" NavigateUri="{Binding RelativeSource={RelativeSource AncestorType={x:Type NavigationWindow}}, Path=BackStack}">
Problem:
Error: Mode must be specified for RelativeSource.
Update:
It is not navigation to th...
Update:
I've included some diagnostics in the SelectedValue property (diagnostics:PresentationTraceSources.TraceLevel=High) and I think I can see the issue, although I do not know how to fix it. The diagnostics show
System.Windows.Data Warning: 76 : BindingExpression (hash=16001149): TransferValue - got raw value '3'
System.Windows...