开发者

SL3 Dataform Datafields in Border

Can you surround Datafields in a开发者_运维知识库 border? I have a large form that needs to be organized into sections, "Customer INformation" for instance.

Is there a way to surround these with a border?


I kinda get the feeling you are not specifying your own edit template for the control but a letting data form do it for you. I get this feeling because if you are already using an edit template you wouldn't be asking the question. Consider this:-

    <dataform:DataForm x:Name="dataForm">
        <dataform:DataForm.EditTemplate>
            <DataTemplate>
                <StackPanel>
                    <Border BorderBrush="Black" BorderThickness="2">
                        <StackPanel>
                            <dataform:DataField>
                                <TextBox Text="{Binding ID, Mode=TwoWay}" />
                            </dataform:DataField>
                            <dataform:DataField>
                                <TextBox Text="{Binding Name, Mode=TwoWay}" />
                            </dataform:DataField>
                        </StackPanel>
                    </Border>
                    <dataform:DataField>
                        <CheckBox IsChecked="{Binding Test, Mode=TwoWay}" />
                    </dataform:DataField>
                </StackPanel>
            </DataTemplate>
        </dataform:DataForm.EditTemplate>
    </dataform:DataForm>

Adding a border around the ID and Name fields is a simple case of placing them in their own StackPanel and putting that in a Border. Basically with a template you can do anything you want with the form appearance, in fact you don't even need the DataField if you feel you can do a better job with label placement etc in your own XAML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜