Click here to Skip to main content
15,899,126 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF window in ICQ style Pin
Pete O'Hanlon5-Feb-09 0:09
mvePete O'Hanlon5-Feb-09 0:09 
GeneralRe: WPF window in ICQ style [modified] Pin
sivaddrahcir6-Feb-09 7:30
sivaddrahcir6-Feb-09 7:30 
QuestionPlease help me Pin
haticeaaaaaa4-Feb-09 20:39
haticeaaaaaa4-Feb-09 20:39 
AnswerDon't bump your post. Pin
Pete O'Hanlon4-Feb-09 23:39
mvePete O'Hanlon4-Feb-09 23:39 
GeneralRe: Don't bump your post. Pin
haticeaaaaaa5-Feb-09 2:45
haticeaaaaaa5-Feb-09 2:45 
GeneralRe: Don't bump your post. Pin
Pete O'Hanlon5-Feb-09 3:07
mvePete O'Hanlon5-Feb-09 3:07 
QuestionSending Email Pin
Ray Cassick4-Feb-09 15:29
Ray Cassick4-Feb-09 15:29 
AnswerRe: Sending Email Pin
Michael Sync8-Feb-09 6:36
Michael Sync8-Feb-09 6:36 
GeneralRe: Sending Email Pin
Ray Cassick8-Feb-09 13:08
Ray Cassick8-Feb-09 13:08 
GeneralRe: Sending Email Pin
Braulio Dez13-Mar-09 6:27
Braulio Dez13-Mar-09 6:27 
AnswerRe: Sending Email Pin
Kevin McFarlane8-Feb-09 7:24
Kevin McFarlane8-Feb-09 7:24 
QuestionBinding To One Object Or To A Property Pin
BlitzPackage4-Feb-09 15:14
BlitzPackage4-Feb-09 15:14 
AnswerRe: Binding To One Object Or To A Property Pin
Pete O'Hanlon4-Feb-09 23:32
mvePete O'Hanlon4-Feb-09 23:32 
GeneralRe: Binding To One Object Or To A Property Pin
BlitzPackage5-Feb-09 2:12
BlitzPackage5-Feb-09 2:12 
GeneralRe: Binding To One Object Or To A Property Pin
Pete O'Hanlon5-Feb-09 2:54
mvePete O'Hanlon5-Feb-09 2:54 
GeneralRe: Binding To One Object Or To A Property Pin
BlitzPackage5-Feb-09 7:08
BlitzPackage5-Feb-09 7:08 
GeneralRe: Binding To One Object Or To A Property Pin
Pete O'Hanlon5-Feb-09 10:40
mvePete O'Hanlon5-Feb-09 10:40 
GeneralRe: Binding To One Object Or To A Property Pin
BlitzPackage6-Feb-09 9:42
BlitzPackage6-Feb-09 9:42 
GeneralRe: Binding To One Object Or To A Property Pin
Pete O'Hanlon6-Feb-09 10:53
mvePete O'Hanlon6-Feb-09 10:53 
QuestionMessage Removed Pin
4-Feb-09 10:34
professionalN_tro_P4-Feb-09 10:34 
AnswerMessage Removed Pin
4-Feb-09 10:55
professionalN_tro_P4-Feb-09 10:55 
GeneralRe: DataTemplate list Horizontally Pin
Gideon Engelberth4-Feb-09 12:04
Gideon Engelberth4-Feb-09 12:04 
GeneralMessage Removed Pin
5-Feb-09 4:36
professionalN_tro_P5-Feb-09 4:36 
GeneralRe: DataTemplate list Horizontally Pin
Gideon Engelberth5-Feb-09 6:30
Gideon Engelberth5-Feb-09 6:30 
The grid rows and columns are created in the code-behind. From the referenced post:

'finds the actual grid used by the list box
Dim d As DependencyObject
d = VisualTreeHelper.GetParent( _
        lstItems.ItemContainerGenerator.ContainerFromIndex(0))
While Not (d Is Nothing OrElse d.GetType() Is GetType(Grid))
    d = VisualTreeHelper.GetParent(d)
End While
If d Is Nothing Then Exit Sub

'once you have the grid, you need to add the rows and columns
Dim rd As RowDefinition
Dim cd As ColumnDefinition
Dim grd As Grid = CType(d, Grid)
lstItems.SetValue(Grid.IsSharedSizeScopeProperty, True)
For i As Integer = 0 To 63
    rd = New RowDefinition
    rd.Height = New GridLength(1, GridUnitType.Star)
    grd.RowDefinitions.Add(rd)
    cd = New ColumnDefinition
    cd.Width = New GridLength(1, GridUnitType.Star)
    grd.ColumnDefinitions.Add(cd)
Next
'this is just for debugging purposes
grd.ShowGridLines = True


You have the right ItemsPanel and ItemContainerStyle, now you just need to bind to the ItemsSource property to get the items. Since you seem to have something you can bind to in XAML, just move the ItemsSource binding from the inner ItemsControl to the ListBox and get rid of the ItemsControl.
<!-- moved the data binding for AvailableObjects to here -->
<ListBox Name="lstItems" Background="Green" ItemsSource="{Binding Path=AvailableObjects}>
        <ListBox.ItemsPanel>
            <!-- what you have here is right -->
        </ListBox.ItemsPanel>
        <ListBox.ItemContainerStyle>
            <!-- what you have here is right -->
        </ListBox.ItemContainerStyle>
        
        <!-- this is wrong, you are adding an items control to the list box
             as its only item, you need to do set ItemsSource instead -->
        <ItemsControl FontWeight="Normal" ItemsSource="{Binding Path=AvailableObjects}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button
                            Grid.Row="{Binding Path=YLoc}"
                            Grid.Column="{Binding Path=XLoc}"
                            Content="{Binding Path=ObjectText}"
                            Margin="2,3.5"
                        />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </ListBox>

GeneralMessage Removed Pin
5-Feb-09 8:29
professionalN_tro_P5-Feb-09 8:29 

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.