Search Results

Search found 669 results on 27 pages for 'itemssource'.

Page 13/27 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Binding scattered/overlapping images to a WPF Canvas

    - by bufferz
    I am porting a GDI application over to WPF, where I displayed several dozen images onto Form, then drew polygons, circles, rectangles, etc over the top of these images using GDI Pens and Brushes. I'm starting to get the hang of WPF binding and would like to store all of these images and markup graphics in my ViewModel. My VM contains an ObservableCollection of my custom DrawingEntitys, DrawingEntity contains DependencyProperties for BitmapSource, Height, Width, CanvasTopLeftY, and CanvasTopLeftX, that I update frequently in the collection. I know my binding is working, I just can't figure out how to bind and draw this collection onto a Canvas. I've played around with ItemsControl and ItemsSource to death, too many different ways to list here. I can display the DrawingEntity.Bitmaps onto the canvas but Canvas.Top won't bind to CanvasTopLeftY in the DrawingEntity, everything is overlapped at 0,0. I think I'm missing an obvious strategy. Any ideas?

    Read the article

  • WPF data grid - Column Header not aligned with data rows

    - by Pawan
    Hi, I am using Datagrid in WPF. This is a very simple and basic implementation. I not using any styles. I created a simple datagrid : <dg:DataGrid x:Name="dg" > </dg:DataGrid> and populated it with data as: dg.ItemsSource = " H E L L O W O R L D!".Split(); Grid gets properly populated but the columnheader of the grid is drawn with some offset. Due to this my data and header are mis aligned. I tried searching for this over net but I haven't found anything. This seems to be a straightforward implementation which is working for everyone except me :(. Can anyone please tell me what might be going wrong? I have tried using different data sets and appyling some style to test this. Thanks in advance.

    Read the article

  • WPF ComboBox SelectedItem - change to previous value

    - by Taylor
    Hello, I have a ComboBox that has the SelectedItem bound to the ViewModel. <ComboBox SelectedItem="{Binding SelItem, Mode=TwoWay}" ItemsSource="{Binding MyItems}"> When the user selects a new Item in the View ComboBox, I want to display a prompt and verify that they want to make the change. In the SetItem Property setter in the View Model, I display a Dialog to confirm the selection. When they say yes, it works fine. My problem is, when the user clicks on "No" I am not sure who to get the ComboBox to revert back to the previous value. The Property in the ViewModel has the correct older value, however in the View the ComboBox displays the newly Selected Value. I want the user to select an item, confirm they want to go ahead with it, and if they decide not to, I want the ComboBox to revert back to the previous item. How can I accomplish this? Thanks!

    Read the article

  • WPF: Bind/Apply Filter on Boolean Property

    - by Julian Lettner
    I want to apply a filter to a ListBox accordingly to the IsSelected property of a CheckBox. At the moment I have something like this. XAML <CheckBox Name="_filterCheckBox" Content="Filter list" Checked="ApplyFilterHandler"/> <ListBox ItemsSource="{Binding SomeItems}" /> CodeBehind public ObservableCollection<string> SomeItems { get; private set; } private void ApplyFilterHandler(object sender, RoutedEventArgs e) { if (_filterCheckBox.IsChecked.Value) CollectionViewSource.GetDefaultView(SomeItems).Filter += MyFilter; else CollectionViewSource.GetDefaultView(SomeItems).Filter -= MyFilter; } private bool MyFilter(object obj) { return ... } It works but this solution feels like the old-fashioned way (Windows Forms). Question: Is it possible to achieve this with Bindings / in XAML? Thanks for your time.

    Read the article

  • WPF Binding Collection To ComboBox and Selecting an item

    - by Adam Driscoll
    I've been knocking my head against this for some time now. I'm not really sure why it isn't working. I'm still pretty new to this whole WPF business. Here's my XAML for the combobox <ComboBox Width="200" SelectedValuePath="Type.FullName" SelectedItem="{Binding Path=Type}" Name="cmoBox" > </ComboBox> Here's what populates the ComboBox (myAssembly is a class I created with a list of possible types) cmoBox.ItemsSource = myAssembly.PossibleTypes; I set the DataContext in a parent element of the ComboBox in the code behind like this: groupBox.DataContext = listBox.SelectedItem; I want the binding to select the correct "possible type" from the combo box. It doesn't select anything. I have tried SelectedValue and SelectedItem. When I changed the DisplayMemberPath of the ComboBox to a different property it changed what was displayed so I know it's not completely broken. Any ideas???

    Read the article

  • Change notification in EF EntityCollection

    - by Savvas Sopiadis
    Hi everybody! In a Silverlight 4 proj i'm using WCF RIA services, MVVM principles and EF 4. I 'm running into this situation: created an entity called Category and another one called CategoryLocale (automated using VS, no POCO). The relation between them is 1 to N respectively (one Category can have many CategoryLocales), so trough this relationship one can implement master-detail scenarios. Everytime i change a property in the master record (Category) i get a notifypropertychanged notification raised. But: whenever i change a property in the detail (CategoryLocales) i don't get anything raised. The detail part is bound to a Datagrid like this: <sdk:DataGrid Grid.Row="3" Grid.ColumnSpan="2" ItemsSource="{Binding SelectedRecord.CategoryLocales,Mode=TwoWay}" AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto" > Any help is appreciated! Thanks in advance

    Read the article

  • Setting Canvas properties in an ItemsControl DataTemplate

    - by atsjoo
    I'm trying to databind to this ItemsControl: <ItemsControl ItemsSource="{Binding Path=Nodes, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> By using this DataTemplate, I'm trying to individually position my Node elements correctly: <DataTemplate DataType="{x:Type Model:EndNode}"> <Controls:EndNodeControl Canvas.Left="{Binding Path=XPos}" Canvas.Top="{Binding Path=YPos}" /> </DataTemplate> However, it's not working as expected. All my node elements are drawn on top of each other in the same position. Any suggestions on how to accomplish this?

    Read the article

  • How can I find any control in the ItemTemplate of a TabControl?

    - by mrok
    Hi, I have a TabControl <TabControl Name="myTabControl" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Margin="4"> <TabControl.ItemTemplate> <DataTemplate> <DockPanel Width="120"> <Button Name="CloseScreen"/> <ContentPresenter Content="{Binding Path=DisplayName}" VerticalAlignment="Center" /> </DockPanel> </DataTemplate> </TabControl.ItemTemplate> </TabControl> I want to find the button which is located in the ItemTemplate from code. Thank you.

    Read the article

  • PropertyChanged doesn't work properly

    - by Karen
    Hello, I have a Silverlight application in which I implemented MVVM pattern. In my application there is a child window on which I have ComboBox. I bound ItemsSource and SelectedItem of my combobox to a property (typeof ObservableCollection) and property of MyType appropriately. MyType is a "MODEL" derived from INotifyPropertyChanged. When my window is loaded I set values to this properties. But my combobox doesn't display selected item. I found that when I set property which is bound to selected item (in ViewModel), the PropertyChanged event is null. Can anyone help me. Thanks.

    Read the article

  • data binding on properties confusion

    - by Xience
    I have a wpf tabitem whose data context is set to my object 'Product'. All the controls on this form get their data from 'Product' object. I have a listview whose ItemsSource property is set to a list in my object 'Product.DetailsList'. Listview columns are bound to object properties in 'Product.DetailsList' Up till here everything works fine. Now I need to bind some of the columns in my listview to the properties in my datacontext object i.e.'Product'. Can someone tell me how can i achieve this?

    Read the article

  • Silverlight + ItemsControl + Get Control Property Value

    - by Villager
    Hello, I have an ItemsControl with a DataTemplate that has been defined. My ItemsControl definition looks like the following: <ItemsControl x:Name="myItemsControl" ItemsSource="{Binding}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <CheckBox x:Name="myCheckBox" Content="{Binding Name}" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> This is a simplified version of my DataTemplate. Regardless, when a user clicks a button on the page, I want to loop through the items in myItemsControl and determine if the CheckBox element associated with the item is checked. How do I determine if a CheckBox is checked for a specific item within an ItemsControl? Thank you!

    Read the article

  • What causes a WPF ListCollectionView that uses custom sorting to re-sort its items?

    - by Drew Noakes
    Consider this code (type names genericised for the purposes of example): // Bound to ListBox.ItemsSource _items = new ObservableCollection<Item>(); // ...Items are added here ... // Specify custom IComparer for this collection view _itemsView = CollectionViewSource.GetDefaultView(_items) ((ListCollectionView)_itemsView).CustomSort = new ItemComparer(); When I set CustomSort, the collection is sorted as I expect. However I require the data to re-sort itself at runtime in response to the changing of the properties on Item. The Item class derives from INotifyPropertyChanged and I know that the property fires correctly as my data template updates the values on screen, only the sorting logic is not being called. I have also tried raising INotifyPropertyChanged.PropertyChanged passing an empty string, to see if a generic notification would cause the sorting to be initiated. No bananas. EDIT In response to Kent's suggestion I thought I'd point out that sorting the items using this has the same result, namely that the collection sorts once but does not re-sort as the data changes: _itemsView.SortDescriptions.Add( new SortDescription("PropertyName", ListSortDirection.Ascending));

    Read the article

  • Disabling a CellEditingTemplate programmatically in in a Silverlight DataGrid

    - by bplus
    I have a Silverlight Datagrid, I'd like to make certain cells readonly programmatically. Specifically I have a CellEditingTemplate, I'd like to turn the cell editing off or on depending on the value of CategoryTypeName (see the xmal below). <local:DataGridTemplateColumn Header="Category" > <local:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding CategoryTypeName}"/> </DataTemplate> </local:DataGridTemplateColumn.CellTemplate> <local:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <ComboBox Width="90" x:Name="CategoryCombo" ItemsSource="{Binding CategoryTypes}" DisplayMemberPath="Name" SelectionChanged="CategoryCombo_SelectionChanged" /> </DataTemplate> </local:DataGridTemplateColumn.CellEditingTemplate> </local:DataGridTemplateColumn> Is there a way to do this? Any help would be very much appreciated. Thanks in advance.

    Read the article

  • Windows store apps: ScrollViewer with dinamic content

    - by Alexandru Circus
    I have a scrollViewer with an ItemsControl (which holds rows with data) as content. The data from these rows is grabbed from the server so I want to display a ProgressRing with a text until the data arrives. Basically I want the content of the ScrollViewer to be a grid with progress ring and a text and after the data arrives the content to be changed with my ItemsControl. The problem is that the ScrollViewer does not accept more than 1 element as content. Please tell me how can I solve this problem. (I'm a C# beginner) <FlipView x:Name="OptionPagesFlipView" Grid.Row="1" TabNavigation="Cycle" SelectionChanged="OptionPagesFlipView_SelectionChanged" ItemsSource="{Binding OptionsPageItems}"> <FlipView.ItemTemplate> <DataTemplate x:Name="OptionMonthPageTemplate"> <ScrollViewer x:Name="OptionsScrollViewer" HorizontalScrollMode="Disabled" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto"> <ItemsControl x:Name="OptionItemsControl" ItemsSource="{Binding OptionItems, Mode=OneWay}" Visibility="Collapsed"> <ItemsControl.ItemTemplate> <DataTemplate x:Name="OptionsChainItemTemplate"> <Grid x:Name="OptionItemGrid" Background="#FF9DBDF7" HorizontalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <!-- CALL BID --> <TextBlock Text="Bid" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallBidTextBlock" Text="{Binding CallBid}" Foreground="Blue" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" Margin="5,0,5,5" FontSize="18"/> <!-- CALL ASK --> <TextBlock Text="Ask" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallAskTextBlock" Text="{Binding CallAsk}" Foreground="Blue" HorizontalAlignment="Left" Grid.Row="3" Grid.Column="0" Margin="5,0,5,0" FontSize="18"/> <!-- CALL LAST --> <TextBlock Text="Last" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallLastTextBlock" Text="{Binding CallLast}" Foreground="Blue" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Margin="5,0,5,5" FontSize="18"/> <!-- CALL NET CHANGE --> <TextBlock Text="Net Ch" Foreground="Gray" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="CallNetChTextBlock" Text="{Binding CallNetChange}" Foreground="{Binding CallNetChangeForeground}" HorizontalAlignment="Left" Grid.Row="3" Grid.Column="1" Margin="5,0,5,5" FontSize="18"/> <!-- STRIKE --> <TextBlock Text="Strike" Foreground="Gray" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="2" FontSize="18" Margin="5,0,5,0"/> <Border Background="{Binding StrikeBackground}" HorizontalAlignment="Center" Grid.Row="2" Grid.Column="2" Margin="5,0,5,5"> <TextBlock x:Name="StrikeTextBlock" Text="{Binding Strike}" Foreground="Blue" FontSize="18"/> </Border> <!-- PUT LAST --> <TextBlock Text="Last" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="3" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="PutLastTextBlock" Text="{Binding PutLast}" Foreground="Blue" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="3" Margin="5,0,5,5" FontSize="18"/> <!-- PUT NET CHANGE --> <TextBlock Text="Net Ch" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="3" FontSize="18" Margin="5,0,5,0"/> <TextBlock x:Name="PutNetChangeTextBlock" Text="{Binding PutNetChange}" Foreground="{Binding PutNetChangeForeground}" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="3" Margin="5,0,5,5" FontSize="18"/> <!-- PUT BID --> <TextBlock Text="Bid" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="4" FontSize="18" Margin="5,0,15,0"/> <TextBlock x:Name="PutBidTextBlock" Text="{Binding PutBid}" Foreground="Blue" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="4" Margin="5,0,15,5" FontSize="18"/> <!-- PUT ASK --> <TextBlock Text="Ask" Foreground="Gray" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="4" FontSize="18" Margin="5,0,15,0"/> <TextBlock x:Name="PutAskTextBlock" Text="{Binding PutAsk}" Foreground="Blue" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="4" Margin="5,0,15,5" FontSize="18"/> <!-- BOTTOM LINE SEPARATOR--> <Rectangle Fill="Black" Height="1" Grid.ColumnSpan="5" VerticalAlignment="Bottom" Grid.Row="3"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <!--<Grid> <Grid.RowDefinitions> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <ProgressRing x:Name="CustomProgressRing" Height="40" Width="40" IsActive="true" Grid.Column="0" Margin="20" Foreground="White"/> <TextBlock x:Name="CustomTextBlock" Height="auto" Width="auto" FontSize="25" Grid.Column="1" Margin="20"/> <Border BorderBrush="#FFFFFF" BorderThickness="1" Grid.ColumnSpan="2"/> </Grid>--> </ScrollViewer> </DataTemplate> </FlipView.ItemTemplate>

    Read the article

  • Databinding to type double - decimal mark lost

    - by user1277327
    I have a project where I'm databinding a gridview to a list, where one column is databound to a gridview. The problem I have is that with the double being 5.5 on one computer it appears as 5.5 in the gridview. But on another it looks like 55, the decimal mark dissapears. So 3.14 will look like 314 etc. The error occurs with the following code: myDatagrid.ItemsSource = someList; Binding binding = new Binding("DoubleValue"); myColumnInDatagrid.Binding = binding; I've also tried using a very simple valueconverter, that just return the double, and parsed it in ConvertBack. I'm pretty new to WPF so I'm sorry if I've made some obvious mistakes, I just don't understand why it works on one computer but not on the other. Perhaps it should be noted that both of the computers use the same operating system, with the same language settings (afaik at least).

    Read the article

  • Can't get up with RIA demo: part 2

    - by Budda
    Here is a topic: http://stackoverflow.com/questions/2507734/cant-get-up-with-ria-demo where I've described problem with getting access to DomainContext object on the client. That time problem was resolved himself (without any actions from my side, with Visual Studio restart). At the moment, I had the same problem on another PC (Vista x64, VS2008, Silverlight 3.0, RIA Services Toolkit): ThomasDomainContext class that inherits DomainContext was not visible from the page's codebehind file. Again, it was resolved after VS restart and after that I got another problem: Error 1 'VfmElita.Web.ClientBin.ThomasDomainContext' does not contain a definition for 'employee' and no extension method 'employee' accepting a first argument of type 'VfmElita.Web.ClientBin.ThomasDomainContext' could be found (are you missing a using directive or an assembly reference?) D:\Project\Budda\VFMElita\VfmElitaSilverlightClient\MainPage.xaml.cs for the following lines of code (error is noticed for the 31st line): 30: var context = new ThomasDomainContext(); 31: grid1.ItemsSource = context.employee; 32: context.Load(context.GetEmployeeQuery()); Any help is welcome. P.S. Please note, that source code create on the 1st machine is successfully compilable and launchable

    Read the article

  • How to bind a List to a WPF treeview using Xaml?

    - by Joan Venge
    I don't know how to bind a List of Drink to a WPF TreeView. struct Drink { public string Name { get; private set; } public int Popularity { get; private set; } public Drink ( string name, int popularity ) : this ( ) { this.Name = name; this.Popularity = popularity; } } List<Drink> coldDrinks = new List<Drink> ( ){ new Drink ( "Water", 1 ), new Drink ( "Fanta", 2 ), new Drink ( "Sprite", 3 ), new Drink ( "Coke", 4 ), new Drink ( "Milk", 5 ) }; } } I have searched the web, for instance saw here. But what's this even mean: ItemsSource="{x:Static local:TreeTest.BoatList}" x:? static? local? How do you specify a collection in your code in the xaml?

    Read the article

  • View bound to paged collection view not updating all of the time.

    - by Thomas
    I new to silverlight and trying to make a business application using the mvvm pattern and ria services. I have a view model class that contains a PagedCollectoinView and it is set to the item source of a datagrid. When I update the PagedCollectionView the datagrid is only updated the first time then after that subsequent changes to the data to not reflect in the view until after another edit. Things seem to be delayed one edit. Below is a summarized example of my xaml and code behind. This is the code for my view model public class CustomerContactLinks : INotifyPropertyChanged { private ObservableCollection<CustomerContactLink> _CustomerContact; public ObservableCollection<CustomerContactLink> CustomerContact { get { if (_CustomerContact == null) _CustomerContact = new ObservableCollection<CustomerContactLink>(); return _CustomerContact; } set { _CustomerContact = value; } } private PagedCollectionView _CustomerContactPaged; public PagedCollectionView CustomerContactPaged { get { if (_CustomerContactPaged == null) _CustomerContactPaged = new PagedCollectionView(CustomerContact); return _CustomerContactPaged; } } private TicketSystemDataContext _ctx; public TicketSystemDataContext ctx { get { if (_ctx == null) _ctx = new TicketSystemDataContext(); return _ctx; } } public void GetAll() { ctx.Load(ctx.GetCustomerContactInfoQuery(), LoadCustomerContactsComplete, null); } private void LoadCustomerContactsComplete(LoadOperation<CustomerContactLink> lo) { foreach (var entity in lo.Entities) { CustomerContact.Add(entity as CustomerContactLink); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string propertyName) { if (PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } Here is the basics of my XAML <Data:DataGrid x:Name="GridCustomers" MinHeight="100" MaxWidth="1000" IsReadOnly="True" AutoGenerateColumns="False"> <Data:DataGrid.Columns> <Data:DataGridTextColumn Header="First Name" Binding="{Binding Customer.FirstName}" Width="105" /> <Data:DataGridTextColumn Header="MI" Binding="{Binding Customer.MiddleName}" Width="35" /> <Data:DataGridTextColumn Header="Last Name" Binding="{Binding Customer.LastName}" Width="105"/> <Data:DataGridTextColumn Header="Address1" Binding="{Binding Contact.Address1}" Width="130"/> <Data:DataGridTextColumn Header="Address2" Binding="{Binding Contact.Address2}" Width="130"/> <Data:DataGridTextColumn Header="City" Binding="{Binding Contact.City}" Width="110"/> <Data:DataGridTextColumn Header="State" Binding="{Binding Contact.State}" Width="50"/> <Data:DataGridTextColumn Header="Zip" Binding="{Binding Contact.Zip}" Width="45"/> <Data:DataGridTextColumn Header="Home" Binding="{Binding Contact.PhoneHome}" Width="85"/> <Data:DataGridTextColumn Header="Cell" Binding="{Binding Contact.PhoneCell}" Width="85"/> <Data:DataGridTextColumn Header="Email" Binding="{Binding Contact.Email}" Width="118"/> </Data:DataGrid.Columns> </Data:DataGrid> <DataForm:DataForm x:Name="CustomerDetails" Header="Customer Details" AutoGenerateFields="False" AutoEdit="False" AutoCommit="False" CommandButtonsVisibility="Edit" Width="1000" Margin="0,5,0,0"> <DataForm:DataForm.EditTemplate> </DataForm:DataForm.EditTemplate> </DataForm:DataForm> And here is my code behind public Customers() { InitializeComponent(); BusyDialogIndicator.IsBusy = true; Loaded += new RoutedEventHandler(Customers_Loaded); CustomerDetails.BeginningEdit += new EventHandler(CustomerDetails_BeginningEdit); } void CustomerDetails_BeginningEdit(object sender, System.ComponentModel.CancelEventArgs e) { CustomerContacts.CustomerContactPaged.EditItem(CustomerDetails.CurrentItem); } private void Customers_Loaded(object sender, RoutedEventArgs e) { CustomerContacts = new CustomerContactLinks(); CustomerContacts.GetAll(); GridCustomers.ItemsSource = CustomerContacts.CustomerContactPaged; GridCustomerPager.Source = CustomerContacts.CustomerContactPaged; GridCustomers.SelectionChanged += new SelectionChangedEventHandler(GridCustomers_SelectionChanged); BusyDialogIndicator.IsBusy = false; } void GridCustomers_SelectionChanged(object sender, SelectionChangedEventArgs e) { CustomerDetails.CurrentItem = GridCustomers.SelectedItem as CustomerContactLink; } private void SaveChanges_Click(object sender, RoutedEventArgs e) { if (WebContext.Current.User.IsAuthenticated) { bool commited = CustomerDetails.CommitEdit(); if (commited && (!CustomerDetails.IsItemChanged && CustomerDetails.IsItemValid)) { CustomerContacts.Update(CustomerDetails.CurrentItem as CustomerContactLink); CustomerContacts.ctx.SubmitChanges(); CustomerContacts.CustomerContactPaged.CommitEdit(); CustomerContacts.CustomerContactPaged.Refresh(); (GridCustomers.ItemsSource as PagedCollectionView).Refresh(); } } }

    Read the article

  • Adding events to ScatterViewItems when implicitly creating them

    - by James Hay
    Not sure there's too many surface developers on here but hey ho... If i have a scatterview which implicity creates the ScatterViewItem objects (see below), is it possible to retireve the contact events for each scatterViewItem? Also when i wrap tyhe image object in a ScatterViewItem explicitly the item no longer works. Could anyone advise as to why this is the case? <s:ScatterView ItemsSource="{StaticResource DummyData}" > <s:ScatterView.ItemTemplate> <DataTemplate> <Image Source="{Binding Path=ImagePath}" /> </DataTemplate> </s:ScatterView.ItemTemplate> </s:ScatterView>

    Read the article

  • ValueConverter not being invoked in DataTemplate binding

    - by unforgiven3
    I have a ComboBox that uses a DataTemplate. The DataTemplate contains a binding which uses an IValueConverter to convert an enumerated value into a string. The problem is that the value converter is never invoked. This is my XAML: <ComboBox ItemsSource="{Binding Path=StatusChoices, Mode=OneWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource StatusToTextConverter}}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> Is my binding not correct? I thought this is how one implicitly binds to the value a DataTemplate is presenting. Am I wrong?

    Read the article

  • How to evenly space out GridViewColumns in GridView?

    - by Kugel
    Hello, This is my XAML: <ListView ItemsSource="{Binding Items}"> <ListView.View> <GridView> <GridViewColumn Header="Property1" DisplayMemberBinding="{Binding Property1}" /> <GridViewColumn Header="Property2" DisplayMemberBinding="{Binding Property2}" /> </GridView> </ListView.View> </ListView> I want these 2 columns to take up the width of ListView in 1:1 ratio. How can I achieve this?

    Read the article

  • WPF - Listbox bound to collection acts as one item

    - by user553765
    Hi, I have a listbox with the ItemsControl binding the ItemsSource to a readonly collection of strings. The ItemTemplate then declares the DataTemplate as a checkbox where its content is that of the name of the particular item in the collection and IsChecked bound to a property to determine whether or not the item is selected (it's just a listbox of checkboxes) This works fine with one exception - MouseOver the ListBox and it acts as if the collection of Strings is a single item; the whole box acts as if selected. This wouldn't be as much of a problem were it not for this also affecting the scrollbars where they won't get enabled - presumably because it considers the one item as being visible on the screen even though it in actual facts is x+ with only x-y showing on the screen. How do I get the listbox to act as if each individual string is its own item. I assume it acts this way because I declared a datatemplate in order to get a listbox of checkboxes?? Any help would be much appreciated!

    Read the article

  • How to make TwoWay binding on properties of ObservableCollection of custom class using mvvm pattern?

    - by mill
    I have the following class: public class UserGroup { public string GroupName { get; set; } public bool IsIntheGroup{ get; set; } } I want to bind an ObservableCollection of UserGroup items to listbox containing checkbox’s for each item in the collection and the checkbox is cheked based on the IsIntheGroup property of the UserGroup. In my ViewModel I made an ObservableCollection of the UserGroup class: public ObservableCollection Groups { get; set; } and loaded its contents (instances of UserGroup) from my database model I used the following code in my view: ListBox ItemsSource="{Binding Groups, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" ListBox.ItemTemplate DataTemplate StackPanel Orientation="Horizontal" CheckBox IsChecked="{Binding IsIntheGroup, Mode=TwoWay}"/ TextBlock Text="{Binding GroupName}" / /StackPanel /DataTemplate /ListBox.ItemTemplate /ListBox The problem is I am not notified when the user checks/unchecks a check box in the list so my two way binding failed… How do I do a two way binding in such a case?

    Read the article

  • WPF - Correct Syntax for Using Coverter with Current Binding

    - by Andy T
    Hi, I have a collection of hex strings that represent colours and I am binding a combobox's ItemsSource to that collection. The combobox items are templated to have a filled rectangle with the relevant colour. I therefore need to use a converter to convert the hex value to a string. Easy enough. However, Blend is telling me that this syntax is incorrect in my XAML: Fill="{Binding, Converter={StaticResource StringToBrush}}" Apparently, I can't use a converter against plain old 'Binding'. Blend says that something like this is syntactically correct: Fill="{Binding Value, Converter={StaticResource StringToBrush}}" ...However that obviously doesn't work. I'm not quite au fait with binding syntax yet, so obviously I'm getting it wrong. Can anyone advise the correct syntax to achieve what I'm trying to do (convert my bound String using the coverter StringToBrush)? Thanks in advance! AT

    Read the article

  • Silverlight dataGrid binding with ria Service doesn' work

    - by Abdulrhman
    hi every one i'm new to Silverlight and it's totally driving me crazy !! i'm using SL4 and trying to bind datagrid with a Domain Service Query: what i did exactly is i generate an ado.net entity model from my database, then create a domain Service class from this model. then in my page i put Datagrid & button. in the click event for this button i write this code: RRDomainContext rr = new RRDomainContext(); this.dataGrid1.ItemsSource = rr.Rooms; this.rr.Load(this.rr.GetRoomsQuery()); when this method executed the nothing changed at the datagrid. can anyone help me with this ?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >