|
Pete O'Hanlon wrote: the GridView is a much more complex beast
And yet can be used in the simplest fashion with very little work. It seems it should be the default list control to me, I have used an items collection on occasion, I'm just wondering if there is a role for the listview
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I'm just wondering if there is a role for the listview
ListBox you mean?
Just because in your work you always need a grid doesn't mean everyone does. I would bet listboxes are used way more than datagrids.
To me, the fact that "grid" is in the name tells me when I want to use a DataGrid - when I need to present a list of data in a grid (rows and columns). If I just need a selectable list of items then the much lighter weight ListBox is a more appropriate choice.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Just because in your work you always need a grid
I think that may be the issue here, the work I do is very data oriented, lists of information is my primary requirement with almost zero graphics. The most we do is some simple transformations.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: It seems it should be the default list control to me
I'm glad it isn't. Here's an example layout we have - a set of people laid out horizontally at the bottom of the screen. With the Listbox, this was an extremely trivial layout. With a GridView - less trivial.
|
|
|
|
|
Yeah I think Mark got nailed it, I have an extremely narrow data requirement. I once used a listbox to do a horizontal list in a private app rather than work.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Fair enough. You can see now why I commented on the difference in styling the beasts.
|
|
|
|
|
I'd say I usually avoid the ListBox because it makes the UI look "low budget". The work you need to put in should be irrelevant vs the end result. You can customize it, I suppose... but if I was just showing an item with "one column", I'd probably pick a ComboBox.
|
|
|
|
|
How I can access to textblock in DataATemplate
I want to get the value of selectedValue
Here's the code
<Window x:Class="ElementsCloudTestVodafoneSeaWindow.VodafoneSeaWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:data="clr-namespace:ElementsCloudTestVodafoneUpper"
xmlns:cloud="clr-namespace:ElementsCloud;assembly=ElementsCloud"
Title="Data Visualization" Width="640" Height="480" WindowState="Maximized">
<Window.Resources>
<ObjectDataProvider x:Key="objDs"
ObjectType="{x:Type data:CDataAccess}"
MethodName="GetCites">
</ObjectDataProvider>
<DataTemplate x:Key="BookTemplate">
<DataTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.5000000" Value="5,0,0,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01" Value="20,0,20,0"/>
</ThicknessAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="7"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-33"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(SkewTransform.AngleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-43"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.5000000" Value="0,0,-100,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01" Value="0,0,-50,0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.4000000" Value="20,0,20,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01" Value="5,0,0,0"/>
</ThicknessAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="7"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="-33"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(SkewTransform.AngleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="-43"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.4000000" Value="0,0,-50,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01" Value="0,0,-100,0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<Grid Width="150" Height="50" Margin="0,0,-100,0" x:Name="grid">
<StackPanel RenderTransformOrigin="0.55,0.5" Margin="-10,0,0,0" Orientation="Vertical" Background="#FF4C4141" x:Name="stackPanel">
<StackPanel.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</StackPanel.LayoutTransform>
<StackPanel.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="-43" AngleY="0"/>
<RotateTransform Angle="-33"/>
<TranslateTransform X="7" Y="0"/>
</TransformGroup>
</StackPanel.RenderTransform>
<TextBlock FontWeight="Bold" Text="{Binding Mode=OneWay, XPath=Name}" HorizontalAlignment="Center" Foreground="#FFFFFFFF"/>
<TextBlock HorizontalAlignment="Center" FontWeight="Bold" Foreground="#FF9B9B9B" Text="{Binding Mode=OneWay, XPath=Amount}"/>
<TextBlock HorizontalAlignment="Center" FontWeight="Bold" Foreground="#FFFFFFFF" Text="{Binding Mode=OneWay, XPath=Pages}"/>
</StackPanel>
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}" x:Name="Storyboard2_BeginStoryboard"/>
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
<SolidColorBrush x:Key="ListBorder" Color="#828790"/>
<Style x:Key="ItemContainerStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="outsideBorder"
CornerRadius="4" Padding="1">
<ContentPresenter Margin="1" RecognizesAccessKey="True" HorizontalAlignment="Left"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BooksListBoxStyle" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
<Trigger Property="IsGrouping" Value="true">
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ItemsPanelTemplate x:Key="BooksItemsPanelTemplate">
<VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
<Style x:Key="BooksListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Padding" Value="2,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<StackPanel Height="51">
<TextBlock Text="TextBlock" TextWrapping="Wrap"/>
<TextBlock Text="TextBlock" TextWrapping="Wrap"/>
<TextBlock Text="TextBlock" TextWrapping="Wrap"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="Selector.IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="DataTemplate1"/>
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Padding" Value="2,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<StackPanel Height="51">
<TextBlock Text="TextBlock" TextWrapping="Wrap"/>
<TextBlock Text="TextBlock" TextWrapping="Wrap"/>
<TextBlock Text="TextBlock" TextWrapping="Wrap"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="Selector.IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="BookTemplate1">
<StackPanel>
<TextBlock Text="{Binding Mode=OneWay, XPath=Name}"/>
<TextBlock Text="{Binding Mode=OneWay, XPath=Amount}"/>
<TextBlock Text="{Binding Telephone}" TextAlignment="Center"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="BookTemplate2">
<StackPanel>
<TextBlock Text="{Binding Mode=OneWay, XPath=Name}"/>
<TextBlock Text="{Binding Mode=OneWay, XPath=Amount}"/>
<TextBlock Text="{Binding Mode=OneWay, XPath=Pages}"/>
</StackPanel>
</DataTemplate>
<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
<VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
<DataTemplate x:Key="BookTemplate3">
<DataTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-40"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(SkewTransform.AngleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-50"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.5000000" Value="0,0,-100,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01" Value="0,0,-10,0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.4000000" Value="0,0,-10,0"/>
<SplineThicknessKeyFrame KeyTime="00:00:01" Value="0,0,-100,0"/>
</ThicknessAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="-40"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(SkewTransform.AngleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="-50"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<StackPanel Margin="0,0,-100,0" RenderTransformOrigin="0.5,0.5" Width="150" x:Name="stackPanel" Height="70">
<StackPanel.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="-50" AngleY="0"/>
<RotateTransform Angle="-40"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</StackPanel.RenderTransform>
<StackPanel.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFD10B0B" Offset="0"/>
<GradientStop Color="#FFFFFFFF" Offset="1"/>
</LinearGradientBrush>
</StackPanel.Background>
<TextBlock Text="{Binding CityName}" TextAlignment="Center"/>
</StackPanel>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}" x:Name="Storyboard2_BeginStoryboard"/>
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
<ItemsPanelTemplate x:Key="ItemsPanelTemplate2">
<VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
<Style x:Key="ListBoxStyle1" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Width="604" Height="196"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
<Trigger Property="IsGrouping" Value="true">
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="BookTemplate4">
<StackPanel RenderTransformOrigin="0.5,0.5" Margin="0,0,-40,0" Width="150" Height="60">
<StackPanel.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="-50" AngleY="0"/>
<RotateTransform Angle="-50"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</StackPanel.RenderTransform>
<StackPanel.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF20707" Offset="0"/>
<GradientStop Color="#FFFAFAFA" Offset="1"/>
</LinearGradientBrush>
</StackPanel.Background>
<TextBlock Text="{Binding CityName}" TextAlignment="Center"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
<Grid DataContext="{Binding Source={StaticResource objDs}}" >
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="AliceBlue" Offset="1"/>
<GradientStop Color="Black" Offset="0"/>
</LinearGradientBrush>
</Grid.Background>
<ListBox Name="listBox1" ItemTemplate="{DynamicResource BookTemplate3}" ItemsPanel="{DynamicResource ItemsPanelTemplate2}"
Margin="8,71,8,36" ItemsSource="{Binding}"
Style="{DynamicResource ListBoxStyle1}"
Background="{x:Null}" BorderBrush="{x:Null}"
ItemContainerStyle="{StaticResource ItemContainerStyle1}" SelectionChanged="listBox1_SelectionChanged" />
</Grid>
</Window>
modified on Monday, July 4, 2011 7:42 PM
|
|
|
|
|
Somewhere in that HUGE code dump there should be an itemssource={binding observablecollection} and a selecteditem={binding SelectedObject}. The selectedobject then has the information you are looking for, wherever possible use the data container to manipulate your information, NOT your display object.
I do wonder why you used a listbox instead of a gridview, so far I have not ever had to use a listbox.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi
I my SL 4 project used the Silverlight toolkit control : TimePicker.
I referenced the library the dll : System.Windows.Controls.Input.Toolkit
When i compile as Debug no problem. When colmpile as Release i get the following error(TimePicker) :
-Error 10 The type or namespace name 'TimePicker' does not exist in the namespace 'System.Windows.Controls' (are you missing an assembly reference?) C:\Users\user\Desktop\OLD version project\InfoCopy.SuiteSolution_CR funzionante\InfoCopy.SuiteSolution\obj\Release\Views\Interventi\DettagliStoricoDiarioChild.g.i.cs 221 58
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Make sure you have added a reference to the TimePicker in the xaml file where this is being used.
Also, clean your solution once and then try again.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
hi
yes i added ..
xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Also tried to clean and rebuild but getting same error
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
hmm....I just tried and had no problem. What version of the toolkit do you have installed?
Also make sure you've referenced the correct DLL. For example, the path to the assembly I used is C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin\System.Windows.Controls.Input.Toolkit.dll
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
i downloade from here : http://silverlight.codeplex.com/ The April 2010 Silvelight Toolkit
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Should work....works fine here. Make sure the reference exists and is is pointing to the correct assembly in both build configurations.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
In ServiceReference i referenced the System.Window.Controls.Input.Toolkit (i didn't installed the toolkit).
Can you help me with another thing ??
I downloaded the "April2010Toolkit.zip" that contain also the source code .. can i use only the code of TimePicker ???
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
jadughar wrote: (i didn't installed the toolkit).
So you got it working now? How did you reference an assembly that wasn't installed?
jadughar wrote: I downloaded the "April2010Toolkit.zip" that contain also the source code .. can i use only the code of TimePicker ???
I suppose you could, but I wouldn't. The source code is there to allow the community to help with development and debugging as these new things are being developed, but using it in production code is unwise.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: So you got it working now? How did you reference an assembly that wasn't installed?
No not got it working yet.As i downloaded the "April2010Toolkit.zip", that contains the System.Winodws.Control.Input.Toolkit.dll file, and i referenced to this.
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
I'm confused. You stated "i didn't installed the toolkit". You need to install it to reference the correct assembly since that's where the control implementation is.
So if you did install it, what's not working?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I am using a Silverlight enabled WCF Service with the following attribute:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
It has a method say
[OperationContract]
public IEnumerable<Entity> GetAllEntities();
Sometimes I want to call this method multiple times within short span of time.. as WCF calls from Silverlight have to be asynchromous, the second call ends up getting called before the first one returned with the results. This results into the UserState getting corrupted. I find that the UserState of one of the calls gets overwritten by that of another call. I find this problem when the calls return and I extract the UserState from the EventArgs.
This seems to be a concurrency problem. I know we should avoid design which causes such multiple calls in Silverlight, but in some cases you just have to. Is there any workaroung/ solution to this problem?
Pankaj Chamria
|
|
|
|
|
Well, call the second service once the first one executes. No other choice.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Just asking....the UserState you refer to is your object right?
Like Abhinav S mentioned, you need to chain the asynchronous calls.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You mean the UserState on the server, right?
Either you need to write the service so that it can cope with being run concurrently, or wrap the content of that method with lock(UserState){ ... }. (You don't want to use [Synchronized] because it should be able to run concurrently for different users, even if making it work concurrently for the same one is too hard.) Obviously, the first way is preferred.
I'm guessing your method is actually not just a 'GetAllXxx' but instead updates some server state, because there should be no problem with doing multiple gets in parallel, and also you would not need to call that multiple times (the result could be cached).
Can you explain a bit more about what the service method is doing and why you need to call it multiple times? I would expect that it would be possible to bundle the requests up into a single service call in some way, reducing network traffic as well as reducing your concurrency issues. But you should still write a robust service regarding concurrency.
|
|
|
|
|