This is a migrated thread and some comments may be shown as answers.

binding not working on computer (surface pro 2)

2 Answers 74 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 22 May 2014, 06:58 PM
       we are using a telerik autocomplete box.  Now, the code pasted below works on ALL computers except my surface pro 2.  any reason you know of?

Interestingly, this used to work on my machine because I approved the developers update.

The problem is that even though the "SelectedServices" is being populated, the control on the UI is not getting it.  and the control on the UI is not sending down the data either.

I can post any more info you guys need to help trace this.  But again, code works on all computers except surface pro 2 with windows 8.1

​ <telerik:RadAutoCompleteBox x:Name="ServicesAutoCompleteBox"
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Stretch"
AutoCompleteMode="Suggest"
DisplayMemberPath="ItemText"
FilteringBehavior="{StaticResource CustomFilteringBehavior}"
GotFocus="UIElement_OnGotFocus"
ItemsSource="{Binding ServiceItems}"
SelectedItems="{Binding SelectedServices,
UpdateSourceTrigger=PropertyChanged}"
SelectionMode="Multiple"
TextSearchMode="StartsWith"
TextSearchPath="ItemText"
WatermarkContent="Type or click to add Services...."
>
<telerik:RadAutoCompleteBox.BoxesItemTemplate>
<DataTemplate DataType="lookups:ItemLookupViewModel">
<WrapPanel Width="{Binding ElementName=ServicesAutoCompleteBox,
Path=ActualWidth}"
Margin="0 0 -30 0"
>
<TextBlock Padding="0 0 30 0"
Text="{Binding ItemText}"
TextWrapping="Wrap"
/>
</WrapPanel>
</DataTemplate>
</telerik:RadAutoCompleteBox.BoxesItemTemplate>
</telerik:RadAutoCompleteBox>


#region Methods

private void PopulatAutoBoxCollection(object sender)
{
var autoComplete = (RadAutoCompleteBox) sender;
autoComplete.Populate(autoComplete.SearchText);
}

#endregion

#region Event Handlers

private void UIElement_OnGotFocus(object sender, RoutedEventArgs e)
{
PopulatAutoBoxCollection(sender);
}

#endregion


public class CustomFilteringBehavior : FilteringBehavior
{
#region Methods

public override IEnumerable<object> FindMatchingItems(string searchText, System.Collections.IList items, IEnumerable<object> escapedItems, string textSearchPath, TextSearchMode textSearchMode)
{
if (string.IsNullOrEmpty(searchText))
{
return items.OfType<object>().Where(x => !escapedItems.Contains(x));
}
return base.FindMatchingItems(searchText, items, escapedItems, textSearchPath, textSearchMode);
}

#endregion
}






public ObservableCollection<ItemLookupViewModel> ServiceItems { get; private set; }

public ObservableCollection<ItemLookupViewModel> SelectedServices { get; set; }


SelectedServices = new ObservableCollection<ItemLookupViewModel>();
SelectedServices.CollectionChanged += SelectedServicesCollectionChanged;

// Set Services.-- this copies data from the model into the bound control

            foreach (var serviceItem in _solicitation.Services)
foreach (var serviceItemVm in ServiceItems)
if (serviceItem.Service.RefItemId == serviceItemVm.ItemId)
SelectedServices.Add(serviceItemVm);

private void SelectedServicesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
IndicateSolicitationChanged();

if (e.NewItems != null && e.NewItems.Count != 0)
{
// foreach (ItemLookupViewModel siVm in e.NewItems)
// {
// }
}

if (e.OldItems != null && e.OldItems.Count != 0)
{
foreach (ItemLookupViewModel siVm in e.OldItems)
siVm.Cleanup();
}
}







2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 23 May 2014, 12:21 PM
Hi Robert,

This is really strange and at the same time interesting issue and we would like to get to the bottom of it. So first we need to make sure that we have the right project in which the issue can be reproduced. Therefore I have created a project where I have tried to get as close as i can to your scenario and it would be great if you can check it out and let us know if the issue can be reproduce in it.

Please note, that right now we cannot get our hands on Surface pro 2 in order to test the issue, but I hope soon we will be able to.

Meanwhile it would be great if you can let us know what versions of the Operating System and .Net are installed on the tested machines as well as if they have any touch monitor (like the Surface pro 2).


Regards,
Georgi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Robert
Top achievements
Rank 1
answered on 16 Jun 2014, 04:29 PM
interestingly, I upgrade the wpf controls to recent version and uninstalled older versions.  (regular windows update in the iterim), and lo and behold, the controls began working again.

i don't plan on doing any more investigation or analysis at this point. 

thanks for the help!
Tags
AutoCompleteBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Robert
Top achievements
Rank 1
Share this question
or