在我的 WPF 应用程序中,我创建了一个带有方向=水平的堆栈面板的停靠面板。
我在我的堆栈面板上添加了一些按钮(如工具栏)
我希望能够将我的堆栈面板上的最后一项设置为附加到我的窗口右侧。
一些图片以便解释。
我有的 :
我会拥有什么:
这是我的 XAML:
<DockPanel Height="40" VerticalAlignment="Top" >
<Border>
<StackPanel Orientation="Horizontal" Background="{StaticResource DegradeCouleurTheme}">
<Image Source="ElipseGauche.png" Height="28" Margin="10,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Premier">
<Image Source= "xRtDiva_XWPF_TBR_PREMIER.PNG_IMAGES.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Precedent">
<Image Source= "xRtDiva_XWPF_TBR_PRECED.PNG_IMAGES.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Suivant">
<Image Source= "xRtDiva_XWPF_TBR_SUIVANT.PNG_IMAGES.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Goto_Dernier">
<Image Source= "xRtDiva_XWPF_TBR_DERNIER.PNG_IMAGES.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Creer" >
<Image Source= "Toolbar_Creer.png" Height="16" />
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Supprimer">
<Image Source= "Toolbar_Supprimer.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Joints">
<Image Source= "Toolbar_FicJoints.png" Height="18"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Annuler" >
<Image Source= "Toolbar_Annuler.png" Height="16"/>
</Button>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_Evenement_Valider">
<Image Source= "Toolbar_Valider.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_App_Parametrer" >
<Image Source= "Toolbar_Parametrer.png" Height="16"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
<Grid HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal" Height="28" >
<Image Source="ElipseGauche.png" Height="28" Margin="15,0,0,0" />
<StackPanel Orientation="Horizontal" Height="28">
<StackPanel.Background>
<ImageBrush ImageSource="ElipseMilieu.png"></ImageBrush>
</StackPanel.Background>
<Button Template="{StaticResource BoutonRessourcesTpl}" Click="Button_Click_About" >
<Label Margin="0,0,0,1" Foreground="White" Content="About" Height="16" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="0,0,0,0"/>
</Button>
</StackPanel>
<Image Source="ElipseDroite.png" Height="28" Margin="0,0,0,0" />
</StackPanel>
</Grid>
</StackPanel>
</Border>
</DockPanel>
我尝试在我的堆栈面板的最后一项上使用带有 Horizontalaligneemnt = right 的网格,但它没有效果(这是逻辑!)
任何人都可以帮助我吗?
非常感谢 :)