Silverlight 3 - Accordian Item 中的数据网格 - 如何设置标题

发布于 2024-08-03 11:17:54 字数 270 浏览 2 评论 0原文

我有一个手风琴控件,我在其中添加了一个数据网格。

问题是我无法设置显示数据网格的手风琴项目的标题。

我只能在 AccordionItem 类的对象上设置标题,而不能在将 Datagrid 添加到 Accordion 时设置标题。

我还尝试将 Datagrid 添加到已添加到 Accordion 的 Accordionitem 对象,但未能成功。我不知道如何将 Datagrid 添加到 Accordonite 对象。

感谢您的帮助。

谢谢, 我

I have an Accordion control to which I have added a datagrid.

The problem is that I cannot set the header of the accordian item that displays the Datagrid.

I can only set the header on the object of the class AccordionItem and not when the Datagrid is added to the Accordion.

I also tried to add the Datagrid to the Accordionitem object that was added to the Accordion but could not succeed. I can't figure out how to add Datagrid to accordonitem object.

Appreciate your help.

Thanks,
I

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人│生佛魔见 2024-08-10 11:17:54

Accordion 仅具有 AccordionItem 子项。您应该像这样将子项明确设置为 AccordionAccordion 的示例,其中 StackPanel 作为子项和标题模板) :

<layoutToolkit:Accordion 
        x:Name="accordion" 
        ExpandDirection="Down" 
        HorizontalAlignment="Stretch" 
        HorizontalContentAlignment="Stretch" 
        SelectionChanged="Accordion_SelectionChanged" 
        AccordionButtonStyle="{StaticResource DateAccordionButtonStyle}" 
        Background="White"
        Padding="2"
        >
    <layoutToolkit:AccordionItem x:Name="dayAI" Background="{StaticResource OutlookCalendarColor}" >
        <layoutToolkit:AccordionItem.HeaderTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal" Margin="0,0,0,2">
                    <Image VerticalAlignment="Center" Source="{Binding Day, Source={StaticResource ImagesPath}}" Stretch="Uniform" />
                    <TextBlock FontWeight="Bold" VerticalAlignment="Center" Text="{Binding Resource.Day, Source={StaticResource LocalizedStrings}}" Margin="5,0,0,0" />
                </StackPanel>
            </DataTemplate>
        </layoutToolkit:AccordionItem.HeaderTemplate>
        <StackPanel >
            <RadioButton Margin="5,5,5,5" x:Name="todayRB" GroupName="RBGroup" Content="{Binding Resource.Today, Source={StaticResource LocalizedStrings}}" Checked="RB_Checked"/>
            <RadioButton Margin="5,5,5,5" x:Name="yesterdayRB" GroupName="RBGroup" Content="{Binding Resource.Yesterday, Source={StaticResource LocalizedStrings}}" Checked="RB_Checked"/>
            <RadioButton Margin="5,5,5,5" x:Name="dayPickerRB" GroupName="RBGroup"  Checked="RB_Checked">
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="{Binding Resource.Day, Source={StaticResource LocalizedStrings}}" Margin="0,0,5,0" VerticalAlignment="Center"/>
                    <Controls:DatePicker x:Name="dayPickerDP" />
                </StackPanel>
            </RadioButton>
        </StackPanel>
    </layoutToolkit:AccordionItem>
</layoutToolkit:Accordion>

所以在你的情况下,它会是这样的:

<Accordion>
   <AccordionItem Header="My header text">
     <DataGrid x:Name="MyDataGrid"/>
   </AccordionItem>
</Accordion>

希望这对你有意义。

An Accordion has only AccordionItem children. You should set the child explicitly to the Accordion like that (example of an Accordion with a StackPanel as a child and a template for the header):

<layoutToolkit:Accordion 
        x:Name="accordion" 
        ExpandDirection="Down" 
        HorizontalAlignment="Stretch" 
        HorizontalContentAlignment="Stretch" 
        SelectionChanged="Accordion_SelectionChanged" 
        AccordionButtonStyle="{StaticResource DateAccordionButtonStyle}" 
        Background="White"
        Padding="2"
        >
    <layoutToolkit:AccordionItem x:Name="dayAI" Background="{StaticResource OutlookCalendarColor}" >
        <layoutToolkit:AccordionItem.HeaderTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal" Margin="0,0,0,2">
                    <Image VerticalAlignment="Center" Source="{Binding Day, Source={StaticResource ImagesPath}}" Stretch="Uniform" />
                    <TextBlock FontWeight="Bold" VerticalAlignment="Center" Text="{Binding Resource.Day, Source={StaticResource LocalizedStrings}}" Margin="5,0,0,0" />
                </StackPanel>
            </DataTemplate>
        </layoutToolkit:AccordionItem.HeaderTemplate>
        <StackPanel >
            <RadioButton Margin="5,5,5,5" x:Name="todayRB" GroupName="RBGroup" Content="{Binding Resource.Today, Source={StaticResource LocalizedStrings}}" Checked="RB_Checked"/>
            <RadioButton Margin="5,5,5,5" x:Name="yesterdayRB" GroupName="RBGroup" Content="{Binding Resource.Yesterday, Source={StaticResource LocalizedStrings}}" Checked="RB_Checked"/>
            <RadioButton Margin="5,5,5,5" x:Name="dayPickerRB" GroupName="RBGroup"  Checked="RB_Checked">
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="{Binding Resource.Day, Source={StaticResource LocalizedStrings}}" Margin="0,0,5,0" VerticalAlignment="Center"/>
                    <Controls:DatePicker x:Name="dayPickerDP" />
                </StackPanel>
            </RadioButton>
        </StackPanel>
    </layoutToolkit:AccordionItem>
</layoutToolkit:Accordion>

So in your case it would be something like:

<Accordion>
   <AccordionItem Header="My header text">
     <DataGrid x:Name="MyDataGrid"/>
   </AccordionItem>
</Accordion>

Hope that makes sense to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文