TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
batshit
NA
1
0
combobox binding json values
May 12 2013 5:39 PM
Hello, I seem to be having an issue with, not knowing how to make a proper binding in WPF.
I have the combobox displaying the proper DisplayName but on selection the value sent is not what is the text in the combo box selection
Here is my combobox
<se:MyComboBox x:Name="AssetLibrarySetName"
Grid.Row="0"
Grid.Column="1"
IsEditable="true"
ItemsSource="{Binding Path=DownloadablePackages}"
Text="{Binding Path=AssetLibrarySetName, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="GameInfo:DownloadablePackageDefinition">
<Label Content="{Binding Path=DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</se:MyComboBox>
Here is the asset code on
public string AssetLibrarySetName
{
get
{
if (this.AssetLibrarySetId == 0)
{
return "Base Game";
}
var package = InfoManager.DownloadablePackages.Items
.Select(kv => kv.Value)
.FirstOrDefault(dp => dp.Id == this.AssetLibrarySetId);
if (package == null)
{
return string.Format("(unknown #{0})", this.AssetLibrarySetId);
}
return string.Format("{1} (#{0})",
this.AssetLibrarySetId,
package.DisplayName);
}
set
{
this.AssetLibrarySetName = value;
if (this.AssetLibrarySetName == "Base Game" )
{
this.AssetLibrarySetId = 0;
}
var package = InfoManager.DownloadablePackages.Items
.Select(kv => kv.Value)
.FirstOrDefault(dp => dp.DisplayName == this.AssetLibrarySetName);
if (package == null)
{
this.AssetLibrarySetId = 0;
}
else
{
this.AssetLibrarySetId = package.Id;
}
}
}
On click the Label Content="{Binding Path=DisplayName}" needs to be sent and its sending "GameInfo.DownloadablePackageDefinition"
what am I missing?
Reply
Answers (
0
)
The calling thread cannot access this object because a diffe
How can I make menus with animation in wpf?