Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced ObjectDataSource control - DataSource bound to ViewModel
Added TwitFaves sample demonstrating ObjectDataSource and ActivityControl
- Loading branch information
Showing
40 changed files
with
2,690 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<fxui:ViewUserControl | ||
xmlns="http://schemas.microsoft.com/client/2007" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:fxui="clr-namespace:SilverlightFX.UserInterface;assembly=SilverlightFX" | ||
xmlns:fxdata="clr-namespace:SilverlightFX.Data;assembly=SilverlightFX" | ||
xmlns:fxaction="clr-namespace:SilverlightFX.UserInterface.Actions;assembly=SilverlightFX" | ||
x:Class="Experiments.DataSourcePage" | ||
ModelType="Experiments.DataViewModel"> | ||
<Grid Background="White" Margin="20" HorizontalAlignment="Center"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="60" /> | ||
<ColumnDefinition Width="300" /> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
|
||
<TextBlock Style="{StaticResource flatLabel}" Text="Search:" VerticalAlignment="Center" FontWeight="Bold" /> | ||
<TextBox x:Name="searchTextBox" Margin="2" Grid.Column="1" /> | ||
|
||
<Button x:Name="searchButton" Grid.Row="1" Grid.Column="1" Margin="2" Width="75" Height="23" HorizontalAlignment="Center" | ||
Content="Search" /> | ||
|
||
<ListBox x:Name="searchResults" VerticalAlignment="Top" Grid.Row="2" Grid.ColumnSpan="2" Margin="2" | ||
ItemsSource="{Binding ElementName=itemsDataSource, Path=Data}" /> | ||
|
||
<fxdata:ObjectDataSource x:Name="itemsDataSource" QueryName="GetItems" AutoLoadData="True"> | ||
<fxdata:ObjectDataSource.QueryParameters> | ||
<fxdata:BoundParameter ParameterName="prefix" ValueBinding="{Binding ElementName=searchTextBox, Path=Text}" /> | ||
</fxdata:ObjectDataSource.QueryParameters> | ||
</fxdata:ObjectDataSource> | ||
</Grid> | ||
</fxui:ViewUserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// DataSourcePage.xaml.cs | ||
// | ||
|
||
using System; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.ComponentModel; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using SilverlightFX.UserInterface; | ||
|
||
namespace Experiments { | ||
|
||
public class DataItem { | ||
|
||
public string Name { get; set; } | ||
|
||
public int Value { get; set; } | ||
|
||
public override string ToString() { | ||
return Name + " (" + Value + ")"; | ||
} | ||
} | ||
|
||
public class DataViewModel : ViewModel { | ||
|
||
private List<DataItem> Items = new List<DataItem>() { | ||
new DataItem() { Name = "Foo" }, | ||
new DataItem() { Name = "FooBar" }, | ||
new DataItem() { Name = "Baz" }, | ||
new DataItem() { Name = "FooBarBaz" } | ||
}; | ||
|
||
public IEnumerable<DataItem> GetItems(string prefix) { | ||
List<DataItem> items = Items.Where(i => i.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).ToList(); | ||
foreach (DataItem dataItem in items) { | ||
dataItem.Value++; | ||
} | ||
|
||
return items; | ||
} | ||
} | ||
|
||
public partial class DataSourcePage : ViewUserControl { | ||
|
||
public DataSourcePage() { | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Application | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:fxapp="clr-namespace:SilverlightFX.Applications;assembly=SilverlightFX" | ||
xmlns:fxdata="clr-namespace:SilverlightFX.Data;assembly=SilverlightFX" | ||
xmlns:data="clr-namespace:TwitFaves.Data" | ||
x:Class="TwitFaves.App"> | ||
|
||
<Application.ApplicationLifetimeObjects> | ||
<fxapp:ApplicationContext x:Name="appContext" WindowName="TwitFaves.MainWindow"> | ||
<data:TwitterService /> | ||
</fxapp:ApplicationContext> | ||
</Application.ApplicationLifetimeObjects> | ||
|
||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Assets/Theme.xaml"/> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<fxdata:StringFormatter x:Key="stringFormatter" /> | ||
<fxdata:VisibilityConverter x:Key="visibilityConverter" /> | ||
<fxdata:DateFormatter x:Key="dateFormatter" /> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// App.xaml.cs | ||
// | ||
|
||
using System; | ||
using System.Windows; | ||
|
||
namespace TwitFaves { | ||
|
||
public partial class App : Application { | ||
|
||
public App() { | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.