silverlight-3.0

Is there any difference in x:name and name for controls in xaml file?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 15:39:45
I am new in Silverlight. When I add some control to my xaml file with Visual Studio it set controls name with Name property, but there is also x:Name. Is there any difference and when to use each of them? Thanks. In Brief Yes there is a difference. The bottom line is that x:Name can be used on object elements that do not have Name properties of their own. A longer explanation You can only use Name on an element that represents an object that actually does have a Name property. For example anything that derives from FrameworkElement . The x:Name attribute may be placed on any element that

Access ResourceDictionary items programmatically

泪湿孤枕 提交于 2019-11-27 08:22:21
I have a Silverlight controls assembly, called "MySilverlightControls". Several folders down into that assembly I have a class which extends a grid column from a third party vendor, let's call it "MyImageColumn.cs". I have also created a resource dictionary called Generic.xaml , this is situated in the Themes folder of the assembly. In that resource dictionary i have defined a ControlTemplate called MyImageColumnTemplate : <ControlTemplate x:Name="MyImageColumnTemplate" > <Grid Margin="8,8,4,4" MaxHeight="32" MaxWidth="32"> <Grid.Resources> <localGrid:StatusColumnImageConverter x:Key=

Invalid cross-thread access issue

早过忘川 提交于 2019-11-27 06:59:21
I have two ViewModel classes : PersonViewModel and PersonSearchListViewModel. One of the fields PersonViewModel implements is a profile image that is downloaded via WCF(cached locally in isolated storage). The PersonSearchListViewModel is a container class that holds a list of Persons. Since loading images is relatively heavy, PersonSearchListViewModel loads only images for the current, next and previous page (results are paged on UI)...to further improve the load of images I put the load of images on another thread. However multi-threading approach causes cross-thread access issues.

Is there any difference in x:name and name for controls in xaml file?

我只是一个虾纸丫 提交于 2019-11-27 04:07:25
问题 I am new in Silverlight. When I add some control to my xaml file with Visual Studio it set controls name with Name property, but there is also x:Name. Is there any difference and when to use each of them? Thanks. 回答1: In Brief Yes there is a difference. The bottom line is that x:Name can be used on object elements that do not have Name properties of their own. A longer explanation You can only use Name on an element that represents an object that actually does have a Name property. For

Sync SelectedItems in a muliselect listbox with a collection in ViewModel

╄→гoц情女王★ 提交于 2019-11-26 21:51:51
I have a multi-select listbox in a SL3 app using prism and I need a collection in my viewmodel that contains the currently selected items in the listbox. The viewmodel doesn't know anything about the view so it does not have access to the listbox control. Also I need to be able to clear the selected items in the listbox from the viewmodel. Not sure how to approach this problem thanks Michael So, assume you have a ViewModel with the following properties: public ObservableCollection<string> AllItems { get; private set; } public ObservableCollection<string> SelectedItems { get; private set; } You

Clear Binding in Silverlight (Remove Data Binding from SetBinding)

雨燕双飞 提交于 2019-11-26 21:15:41
问题 How do you Clear/Remove DataBinding in Silverlight? similar to: Remove binding in WPF using code But the BindingOperations.ClearBinding() method does not exist in Silverlight 3. 回答1: The BindingOperations.ClearBinding() method calls ClearValue() internally. public static void ClearBinding(DependencyObject target, DependencyProperty dp) { if (target == null) { throw new ArgumentNullException("target"); } if (dp == null) { throw new ArgumentNullException("dp"); } if (IsDataBound(target, dp)) {

Silverlight XAML Attribute Definition Order Matters

删除回忆录丶 提交于 2019-11-26 21:13:50
问题 I was working with the ComboBox control and couldn't get the SelectedItem to be set from the property on my viewmodel. Here is the control definition: <ComboBox x:Name="jobEmployee" Grid.Column="1" Grid.Row="2" Margin="4" HorizontalAlignment="Left" Width="150" SelectedItem="{Binding Path=EditingJob.Employee, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" ItemsSource="{Binding Path=Employees, Mode=OneWay}" DisplayMemberPath="FullName"/> I had another Combobox control

Access ResourceDictionary items programmatically

。_饼干妹妹 提交于 2019-11-26 14:07:58
问题 I have a Silverlight controls assembly, called "MySilverlightControls". Several folders down into that assembly I have a class which extends a grid column from a third party vendor, let's call it "MyImageColumn.cs". I have also created a resource dictionary called Generic.xaml , this is situated in the Themes folder of the assembly. In that resource dictionary i have defined a ControlTemplate called MyImageColumnTemplate : <ControlTemplate x:Name="MyImageColumnTemplate" > <Grid Margin="8,8,4

Invalid cross-thread access issue

谁说我不能喝 提交于 2019-11-26 13:00:19
问题 I have two ViewModel classes : PersonViewModel and PersonSearchListViewModel. One of the fields PersonViewModel implements is a profile image that is downloaded via WCF(cached locally in isolated storage). The PersonSearchListViewModel is a container class that holds a list of Persons. Since loading images is relatively heavy, PersonSearchListViewModel loads only images for the current, next and previous page (results are paged on UI)...to further improve the load of images I put the load of

Sync SelectedItems in a muliselect listbox with a collection in ViewModel

时间秒杀一切 提交于 2019-11-26 08:06:34
问题 I have a multi-select listbox in a SL3 app using prism and I need a collection in my viewmodel that contains the currently selected items in the listbox. The viewmodel doesn\'t know anything about the view so it does not have access to the listbox control. Also I need to be able to clear the selected items in the listbox from the viewmodel. Not sure how to approach this problem thanks Michael 回答1: So, assume you have a ViewModel with the following properties: public ObservableCollection