![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | A question in itemscontrol : to control the gridsplitter Dear all: I wrote a class based on ItemsControl, and i also wrote its ControlTemplate. In ControlTemplate, I use a Grid to place the items.Like below <Grid IsItemsHost="True"/> I segment the grid to an 1*2 dimention, and uesd a GridSplitter to control it. But the GridSplitter can't not work in the ItemsControl. Could somebody have the experience to help me. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: A question in itemscontrol : to control the gridsplitter Can you post more detailed code/markup of your setup so we can help you a little more effectivelly. wisenighthsu@ulead.com.tw wrote: > Dear all: > > I wrote a class based on ItemsControl, and i also wrote its > ControlTemplate. > In ControlTemplate, I use a Grid to place the items.Like below > > <Grid IsItemsHost="True"/> > > I segment the grid to an 1*2 dimention, and uesd a GridSplitter to > control it. > But the GridSplitter can't not work in the ItemsControl. > Could somebody have the experience to help me. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: A question in itemscontrol : to control the gridsplitter sorry Marcus, I should write it detail. <!-------------------the controltemplate:-------------> <Style x:Key="{x:Type local:MyControl}" TargetType="{x:Type local:MyControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:MyControl}"> <Grid x:Name="MyGrid" IsItemsHost="True"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <!----------------------XAML---------------------------> <local:MyControl Width="200" Height="200"> <Button Grid.Row="0"/> <Button Grid.Row="1"/> <GridSplitter Grid.Row="1"/> </local:MyControl> like this. The problem is I can't use the GridSplitter to resize the rowdefinition. Does someone have the experience like this to help me? |
My System Specs![]() |
| | #4 (permalink) |
| | Re: A question in itemscontrol : to control the gridsplitter I rewrite it more detail. Mycontrol is an class base on ItemsControl. I want to use the gridsplitter to change the size of the tow button. But it can't work. namespace ItemsControlTest { class MyControl : ItemsControl { public MyControl() { } } } <Window x:Class="ItemsControlTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ItemsControlTest" Height="300" Width="300" xmlns:local="clr-namespace:ItemsControlTest" > <Window.Resources> <Style x:Key="{x:Type local:MyControl}" TargetType="{x:Type local:MyControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:MyControl}"> <Grid x:Name="MyGrid" IsItemsHost="True"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid> <local:MyControl Width="200" Height="200"> <Button Grid.Row="0"/> <Button Grid.Row="1" Margin="0,5,0,0"/> <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" Height="5" VerticalAlignment="Top"/> </local:MyControl> </Grid> </Window> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: A question in itemscontrol : to control the gridsplitter wisenighthsu@ulead.com.tw 寫道: I rewrite it more detail. Mycontrol is an class base on ItemsControl. I want to use the gridsplitter to change the size of the tow button. But it can't work. I want it work like the last two button and gridsplitter namespace ItemsControlTest { class MyControl : ItemsControl { public MyControl() { } } } <Window x:Class="ItemsControlTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ItemsControlTest" Height="300" Width="300" xmlns:local="clr-namespace:ItemsControlTest" > <Window.Resources> <Style x:Key="{x:Type local:MyControl}" TargetType="{x:Type local:MyControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:MyControl}"> <Grid x:Name="MyGrid" IsItemsHost="True"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <StackPanel> <local:MyControl Width="200" Height="200"> <Button Grid.Row="0" Height="Auto" Width="Auto"/> <Button Grid.Row="1" Height="Auto" Width="Auto" Margin="0,5,0,0"/> <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" Height="5" VerticalAlignment="Top"/> </local:MyControl> <Grid Width="200" Height="200" Margin="0,10,0,0"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Button Grid.Row="0" Height="Auto" Width="Auto"/> <Button Grid.Row="1" Height="Auto" Width="Auto" Margin="0,5,0,0"/> <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" Height="5" VerticalAlignment="Top"/> </Grid> </StackPanel> </Window> |
My System Specs![]() |
| Thread Tools | |
| |