Click here to Skip to main content
15,886,037 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF DataGrid Not SHowing Any Data Pin
Pete O'Hanlon20-Sep-12 12:01
mvePete O'Hanlon20-Sep-12 12:01 
GeneralRe: WPF DataGrid Not SHowing Any Data Pin
Kevin Marois20-Sep-12 13:23
professionalKevin Marois20-Sep-12 13:23 
GeneralRe: WPF DataGrid Not SHowing Any Data Pin
Pete O'Hanlon20-Sep-12 13:58
mvePete O'Hanlon20-Sep-12 13:58 
Questionstackedbarseries chart: change the axes display Pin
ashlyacht19-Sep-12 10:03
ashlyacht19-Sep-12 10:03 
Question[XML] XML binding Pin
Jayme6519-Sep-12 7:10
Jayme6519-Sep-12 7:10 
Questionplay streaming videos from internet in wpf Pin
sudeep kushwaha17-Sep-12 18:31
sudeep kushwaha17-Sep-12 18:31 
AnswerRe: play streaming videos from internet in wpf Pin
Mycroft Holmes17-Sep-12 20:05
professionalMycroft Holmes17-Sep-12 20:05 
QuestionItemsControl with Horizontal orientation Pin
Kenneth Haugland17-Sep-12 7:25
mvaKenneth Haugland17-Sep-12 7:25 
So I have this XAML code:
XML
<Window.Resources>
    <local:MainViewModel x:Key="ViewModel" />
</Window.Resources>

And this is the XAML for the actual control:
XML
<StackPanel Orientation="Horizontal"  Width="897" Margin="5" DataContext="{StaticResource ViewModel}">
    <ItemsControl Width="897" ItemsSource="{Binding Intersections}">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <WrapPanel  Width="897"  >
                    <RadioButton GroupName="Intersections"
             Content="{Binding Text}"
             IsChecked="{Binding IsChecked, Mode=TwoWay}" Width="150"/>
               </WrapPanel>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</StackPanel>

In the code behind I have this public class:
VB
Public Class MainViewModel
    Sub New()
        Intersections.Add(New Insertion() With {.Text = "Item 1"})
        Intersections.Add(New Insertion() With {.Text = "Item 2", .IsChecked = True})
        Intersections.Add(New Insertion() With {.Text = "Item 3"})
        Intersections.Add(New Insertion() With {.Text = "Item 4"})
    End Sub
    Private _Intersections As New ObjectModel.ObservableCollection(Of Insertion)
    Public Property Intersections() As ObjectModel.ObservableCollection(Of Insertion)
        Get
            Return _Intersections
        End Get
        Set(ByVal value As ObjectModel.ObservableCollection(Of Insertion))
            _Intersections = value
        End Set
    End Property

    Public Class Insertion
        Private _Text As String
        Public Property Text() As String
            Get
                Return _Text
            End Get
            Set(ByVal value As String)
                _Text = value
            End Set
        End Property

        Private _IsChecked As Boolean
        Public Property IsChecked() As Boolean
            Get
                Return _IsChecked
            End Get
            Set(ByVal value As Boolean)
                _IsChecked = value
            End Set
        End Property
    End Class
End Class

The problem Im haveing is to get the RadioButtons to be shown Horizantaly, and I cant figure out how to do that. I have tried to set IsItemsHost="True" but Its giving me the error "A panel with IsItemsHost="true" is not nested in an ItemsControl. Panel must be nested in ItemsControl to get and show items.". Either I heave tried to do this in all the wrong places or Im missing some key information here.

To be clear the code works, but its giving me a stack of the RadioButtons, but I want the side by side like a WrapPanel.

The example is taken from here here[^], and I converted it to VB from C#.

modified 17-Sep-12 13:49pm.

AnswerRe: ItemsControl with Horizontal orientation Pin
Abhinav S17-Sep-12 7:49
Abhinav S17-Sep-12 7:49 
AnswerRe: ItemsControl with Horizontal orientation Pin
Kenneth Haugland17-Sep-12 8:04
mvaKenneth Haugland17-Sep-12 8:04 
GeneralRe: ItemsControl with Horizontal orientation Pin
Abhinav S17-Sep-12 17:25
Abhinav S17-Sep-12 17:25 
GeneralRe: ItemsControl with Horizontal orientation Pin
Kenneth Haugland17-Sep-12 20:24
mvaKenneth Haugland17-Sep-12 20:24 
AnswerRe: ItemsControl with Horizontal orientation Pin
Kenneth Haugland17-Sep-12 9:35
mvaKenneth Haugland17-Sep-12 9:35 
QuestionWPF Editable ComboxBox Question Pin
Kevin Marois14-Sep-12 10:46
professionalKevin Marois14-Sep-12 10:46 
AnswerRe: WPF Editable ComboxBox Question Pin
SledgeHammer0114-Sep-12 11:17
SledgeHammer0114-Sep-12 11:17 
GeneralRe: WPF Editable ComboxBox Question Pin
Kevin Marois15-Sep-12 17:21
professionalKevin Marois15-Sep-12 17:21 
GeneralRe: WPF Editable ComboxBox Question Pin
SledgeHammer0116-Sep-12 7:18
SledgeHammer0116-Sep-12 7:18 
GeneralRe: WPF Editable ComboxBox Question Pin
Kevin Marois16-Sep-12 8:55
professionalKevin Marois16-Sep-12 8:55 
GeneralRe: WPF Editable ComboxBox Question Pin
SledgeHammer0116-Sep-12 9:14
SledgeHammer0116-Sep-12 9:14 
GeneralRe: WPF Editable ComboxBox Question Pin
Kevin Marois16-Sep-12 9:31
professionalKevin Marois16-Sep-12 9:31 
GeneralRe: WPF Editable ComboxBox Question Pin
SledgeHammer0116-Sep-12 10:15
SledgeHammer0116-Sep-12 10:15 
GeneralRe: WPF Editable ComboxBox Question Pin
Kevin Marois16-Sep-12 10:25
professionalKevin Marois16-Sep-12 10:25 
QuestionWPF Datagrid linked to URL Pin
abollmeyer13-Sep-12 18:14
abollmeyer13-Sep-12 18:14 
AnswerRe: WPF Datagrid linked to URL Pin
Pete O'Hanlon13-Sep-12 20:52
mvePete O'Hanlon13-Sep-12 20:52 
GeneralRe: WPF Datagrid linked to URL Pin
abollmeyer13-Sep-12 22:50
abollmeyer13-Sep-12 22:50 

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.