private void InitTitleBlocks() { int idx = 0; TitleBlockList = new ObservableCollection <string>(); TitleBlockList.Clear(); TitleBlockList.Add(AppStrings.R_TBlkNone); if (_DBMgr.SheetCount > 0) { TitleBlockList.Add(AppStrings.R_TBlkFromSelSheet); } if (_DBMgr.TitleBlockCount > 0) { idx++; foreach (FamilySymbol tb in _DBMgr.GetAllTitleBlocks()) { TitleBlockList.Add(ShDbMgr.FormatTitleBlockName(tb)); } } cbxTitleBlock.SelectedIndex = idx; OnPropertyChange("TitleBlockList"); }
// fill in the combo box with the list of title blocks // along with the one or two special options private void SetupTitleBlockList() { int offset = 0; intFromSheetIdx = -1; // intFirstTbIdx = -1; // add the 2 special options // option 1: no title block cbxTitleBlocks.Items.Add(NOTITLEBLOCK); // option 2: currently selected sheet // we have some sheets - list that as an option if (_DBMgr.SheetCount > 0) { offset++; intFromSheetIdx = offset; cbxTitleBlocks.Items.Add(SHEETTITLEBLOCK); } // got title blocks to add to the list? if (_DBMgr.TitleBlockCount > 0) { offset++; // intFirstTbIdx = offset; // fill-in the list of titleblocks foreach (FamilySymbol fs in _DBMgr.GetAllTitleBlocks()) { cbxTitleBlocks.Items.Add(ShDbMgr.FormatTitleBlockName(fs)); } } // pre-select the first item in the list // which may be the only item cbxTitleBlocks.SelectedIndex = 0 + offset; //return true; }