Click here to Skip to main content
15,887,440 members
Home / Discussions / WPF
   

WPF

 
QuestionWhy do I need a connection string to use an Entity Framework data model? Pin
_T_C_20-Dec-15 7:23
_T_C_20-Dec-15 7:23 
RantRe: Why do I need a connection string to use an Entity Framework data model? Pin
Mycroft Holmes20-Dec-15 12:14
professionalMycroft Holmes20-Dec-15 12:14 
GeneralRe: Why do I need a connection string to use an Entity Framework data model? Pin
_T_C_20-Dec-15 13:04
_T_C_20-Dec-15 13:04 
GeneralRe: Why do I need a connection string to use an Entity Framework data model? Pin
Mycroft Holmes20-Dec-15 19:23
professionalMycroft Holmes20-Dec-15 19:23 
AnswerRe: Why do I need a connection string to use an Entity Framework data model? Pin
Gerry Schmitz20-Dec-15 18:07
mveGerry Schmitz20-Dec-15 18:07 
AnswerRe: Why do I need a connection string to use an Entity Framework data model? Pin
_T_C_21-Dec-15 7:18
_T_C_21-Dec-15 7:18 
GeneralRe: Why do I need a connection string to use an Entity Framework data model? Pin
Gerry Schmitz23-Dec-15 11:29
mveGerry Schmitz23-Dec-15 11:29 
QuestionHow do I bind based on the value selected in a list box? Pin
_T_C_19-Dec-15 15:45
_T_C_19-Dec-15 15:45 
I'm learning WPF. Yesterday, I was stumped by basic binding, and Gerry Schmitz gave me the push I needed to understand DataContext. Today, I've been challenging myself with progressively more difficult binding tasks.

Now I'm stumped by this one: I have a window with a list box showing chart names. When the user selects a chart on the list box, I want that chart's name and description to appear on the window in text boxes with two-way binding. This image illustrates what I'm talking about:
http://i.imgur.com/63ndQsz.png[^]

I've pasted the XAML code for my ChartsWindow below. All suggestions are appreciated.

-TC

<Window x:Class="TestProject.Charts.ChartsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:testProjectCharts="clr-namespace:TestProject.Charts"
        mc:Ignorable="d"
        d:DataContext="{x:Static testProjectCharts:SampleModels.SampleChartsModel}"
        Title="ChartsWindow" Height="300" Width="600">
    <Grid>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <Grid>
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0" Text="Chart" Margin="6,6,6,0" />
            <ListBox Grid.Row="1" Name="NavigationListBox" VerticalAlignment="Stretch" Width="100" Margin="6,0,6,6" ItemsSource="{Binding Charts}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding ChartName}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

        </Grid>

        <Grid Grid.Column="1">
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="Margin" Value="6,6,6,0" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                </Style>
                <Style TargetType="TextBox">
                    <Setter Property="Margin" Value="6,6,6,0" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                </Style>
            </Grid.Resources>

            <TextBlock Grid.Row="0" Grid.Column="0" Text="Chart ID:" />
            <TextBlock Grid.Row="0" Grid.Column="1" Text="[Bind to the selected chart's ChartId here]" />

            <TextBlock Grid.Row="1" Grid.Column="0" Text="Chart Name:" />
            <TextBox Grid.Row="1" Grid.Column="1" Text="[Bind to the selected chart's ChartName here]" />

            <TextBlock Grid.Row="2" Grid.Column="0" Text="Chart Description:" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="[Bind to the selected chart's ChartDescription here]" />

        </Grid>

    </Grid>
</Window>

AnswerRe: How do I bind based on the value selected in a list box? Pin
_T_C_19-Dec-15 17:59
_T_C_19-Dec-15 17:59 
SuggestionRe: How do I bind based on the value selected in a list box? Pin
Richard Deeming4-Jan-16 3:55
mveRichard Deeming4-Jan-16 3:55 
QuestionRequest for help with simple WPF Pin
_T_C_18-Dec-15 11:14
_T_C_18-Dec-15 11:14 
AnswerRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 11:34
mveGerry Schmitz18-Dec-15 11:34 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 11:53
_T_C_18-Dec-15 11:53 
GeneralRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 12:08
mveGerry Schmitz18-Dec-15 12:08 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 12:42
_T_C_18-Dec-15 12:42 
GeneralRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 12:57
mveGerry Schmitz18-Dec-15 12:57 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 13:01
_T_C_18-Dec-15 13:01 
GeneralRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 12:51
mveGerry Schmitz18-Dec-15 12:51 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 12:58
_T_C_18-Dec-15 12:58 
GeneralRe: Request for help with simple WPF Pin
Mycroft Holmes18-Dec-15 13:20
professionalMycroft Holmes18-Dec-15 13:20 
GeneralRe: Request for help with simple WPF Pin
Gerry Schmitz18-Dec-15 13:34
mveGerry Schmitz18-Dec-15 13:34 
AnswerRe: Request for help with simple WPF Pin
Matt T Heffron18-Dec-15 11:58
professionalMatt T Heffron18-Dec-15 11:58 
GeneralRe: Request for help with simple WPF Pin
_T_C_18-Dec-15 12:22
_T_C_18-Dec-15 12:22 
QuestionWPF - Quick Design Question Pin
Kevin Marois18-Dec-15 5:53
professionalKevin Marois18-Dec-15 5:53 
AnswerRe: WPF - Quick Design Question Pin
Joseph M. Morgan18-Dec-15 7:24
Joseph M. Morgan18-Dec-15 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.