मेरे पास RibbonComboBox
है जिसका उपयोग फ़ॉन्ट आकार सेट करने के लिए किया जाता है। यह एक RibbonGallery
कि विभिन्न फ़ॉन्ट आकार को सूचीबद्ध करता है, उचित FontSize
में दिखाया गया है:WPF :: RibbonGomboBox से अलग RibbonGallery से अलग
<r:RibbonComboBox DataContext="{x:Static vm:RibbonDataModel.FontSizeComboBoxData}"
SelectionBoxWidth="30">
<r:RibbonGallery MaxColumnCount="1"
Command="{Binding Command}"
CommandParameter="{Binding SelectedItem}">
<r:RibbonGallery.GalleryItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding}"
FontSize="{Binding}" />
</Grid>
</DataTemplate>
</r:RibbonGallery.GalleryItemTemplate>
</r:RibbonGallery>
</r:RibbonComboBox>
संपादित यहाँ मेरी ViewModel है:
public static RibbonDataModel
{
public static GalleryData<object> FontSizeComboBoxData
{
get
{
lock (LockObject)
{
const string key = "Font Size";
if (!DataCollection.ContainsKey(key))
{
var value = new GalleryData<object>
{
Command = HtmlDocumentCommands.ChangeFontSize,
Label = "Change Font Size",
ToolTipDescription = "Set the font to a specific size.",
ToolTipTitle = "Change Font Size",
};
var fontSizes = new GalleryCategoryData<object>();
var i = 9.0;
while (i <= 30)
{
fontSizes.GalleryItemDataCollection.Add(i);
i += 0.75;
}
value.CategoryDataCollection.Add(fontSizes);
DataCollection[key] = value;
}
return DataCollection[key] as GalleryData<object>;
}
}
}
}
सब कुछ के रूप में की उम्मीद काम करता है, लेकिन मैं किसी आइटम का चयन करने के बाद गैलरी से, यह RibbonComboBox
में उसी विशाल (या छोटे) FontSize
के साथ गैलरी में उपयोग करता है।
RibbonComboBox
में प्रदर्शित होने पर चयनित आइटम के FontSize
को डिफ़ॉल्ट रूप से "रीसेट" कैसे कर सकता हूं?
क्या आप अपना व्यूमोडेल कोड पोस्ट कर सकते हैं, कृपया? –
अनुरोध के रूप में पोस्ट किया गया। –