,I have a .WPF form which contains a Ribbon Window. I have three forms that opens in this window. These forms opens in DocumentPanel by setting the content to file path. The forms contains the Save,Update,Cancel buttons. Now, i want to remove these buttons from Form that opens in DocumentPanel and add these Save,Update,Cancel button in Ribbon bar and on click of Save button want to SAVE the record of opened form.
Ribbon Main window:
<dxb:BarButtonItem x:Name="MnuBtnInsert" Content="Generate PO" Glyph="Images/Icons/Copy-16x16.png" LargeGlyph="Images/Icons/Copy-32x32.png" ItemClick="MnuBtnInsert_ItemClick"/>
<dxb:BarButtonItem x:Name="MnuBtnModify" Content="Modify Report" Glyph="Images/Icons/Open-16x16.png" LargeGlyph="Images/Icons/Open-32x32.png" ItemClick="MnuBtnModify_ItemClick"/>
<dxb:BarButtonItem x:Name="MnuBtnProjectNew" Content="New" Glyph="Images/Icons/new-16x16.png" LargeGlyph="Images/Icons/new-32x32.png" ItemClick="MnuBtnProjectNew_ItemClick" />
<dxb:BarButtonItem x:Name="MnuBtnCompanyNew" Content="New" Glyph="Images/Icons/new-16x16.png" LargeGlyph="Images/Icons/new-32x32.png" ItemClick="MnuBtnCompanyNew_ItemClick" />
<dxb:BarButtonItem x:Name="MnuBtnCompanySave" Content="Save" Glyph="Images/Icons/save-16x16.png" ItemClick="MnuBtnCompanySave_ItemClick" />
</dxb:BarManager.Items>
<DockPanel>
<dxr:RibbonControl x:Name="ribbonControl1" Height="135" dxbh:BlendHelperForBarsAndRibbon.IsDesignControl="true" DockPanel.Dock="Top" SelectedPageChanged="ribbonControl1_SelectedPageChanged">
<dxr:RibbonDefaultPageCategory>
<dxr:RibbonPage Name="NewProject" Caption="Main">
<dxr:RibbonPageGroup>
<dxr:RibbonPageGroup.ItemLinks>
<dxb:BarButtonItemLink BarItemName="MnuBtnProjectNew"/>
</dxr:RibbonPageGroup.ItemLinks>
</dxr:RibbonPageGroup>
</dxr:RibbonPage>
<dxr:RibbonPage Name="InfillForm" Caption="Infill">
<dxr:RibbonPageGroup>
<dxr:RibbonPageGroup.ItemLinks>
<dxb:BarButtonItemLink BarItemName="MnuBtnInsert"/>
<dxb:BarButtonItemLink BarItemName="MnuBtnModify"/>
</dxr:RibbonPageGroup.ItemLinks>
</dxr:RibbonPageGroup>
</dxr:RibbonPage>
<dxr:RibbonPage Name="CompanyDetails" Caption="Company">
<dxr:RibbonPageGroup>
<dxr:RibbonPageGroup.ItemLinks>
<dxb:BarButtonItemLink BarItemName="MnuBtnCompanyNew"/>
<dxb:BarButtonItemLink BarItemName="MnuBtnCompanySave"/>
</dxr:RibbonPageGroup.ItemLinks>
</dxr:RibbonPageGroup>
</dxr:RibbonPage>
</dxr:RibbonDefaultPageCategory>
</dxr:RibbonControl>
<DockPanel>
<dxd:DockLayoutManager x:Name="dockLayoutManager" Visibility="Hidden">
<dxd:LayoutGroup>
<dxd:LayoutGroup Orientation="Vertical">
<dxd:DocumentGroup>
<dxd:DocumentPanel Name="DocumentPanelInfill" Caption="Infill">
//Infill form opens here
</dxd:DocumentPanel>
<dxd:DocumentPanel Name="DocumentPanelCompany" Caption="Company">
//Company form opens here
</dxd:DocumentPanel>
</dxd:DocumentGroup>
</dxd:LayoutGroup>
</dxd:LayoutGroup>
</dxd:DockLayoutManager>
</DockPanel>
</DockPanel>
</dxb:BarManager>
In Code behind of Ribbon Form:
private void MnuBtnCompanyNew_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
{
if (ribbonControl1.SelectedPage == CompanyDetails)
{
DocumentPanelInfill.Visibility = Visibility.Hidden;
dockLayoutManager.Visibility = Visibility.Visible;
DocumentPanelCompany.Content = new Uri("CompanyDetails.xaml", UriKind.Relative);
DocumentPanelCompany.Visibility = Visibility.Visible;
}
}
private void ribbonControl1_SelectedPageChanged(object sender, RibbonPropertyChangedEventArgs e)
{
if(ribbonControl1.SelectedPage == InfillForm)
{
DocumentPanelCompany.Visibility = Visibility.Hidden;
dockLayoutManager.Visibility = Visibility.Visible;
DocumentPanelInfill.Visibility = Visibility.Visible;
}
else if (ribbonControl1.SelectedPage == NewProject)
{
dockLayoutManager.Visibility = Visibility.Hidden;
}
else if (ribbonControl1.SelectedPage == CompanyDetails)
{
DocumentPanelInfill.Visibility = Visibility.Hidden;
}
}
Please guide me..! When Company form opens in insert mode. I want to insert a record in 'Company' table when Ribbon's SAVE button is clicked. and not on the SAVE button of Company Form. Is it possible. As i open the Company form in Ribbon Window inside DocumentPanel dynamically, and want to use the SAVE button of Ribbon and save record and want to remove the SAVE button of Company Form.