Telerik Forums
UI for WPF Forum
0 answers
74 views

Hello im using telerik version 2021.3.909
I have a RadDocking with a lot of RadPanes that are created with DockingPaneFactory
Most of those panes are FloatingDockable which means when i move my main screen the the 2nd(or any other) monitor those RadPanes stays afloat on the first screen.

I know i can change all of them to docking panels and this will solve my problem, but because i have a lot of RadPanes i cannot place them with Dock.Left/Right/etc

My goal is that all my RadPanes will move when the main window is moving(or resizing)

Ofir
Top achievements
Rank 1
 asked on 08 Aug 2024
1 answer
94 views

Hello,

I would like to ask for your help. When creating RadTreeView my ItemContainerStyle is not working. I would like to connect ViewModel IsExpanded with RadTreeViewItem but I can't do it. The component works fine for me if I define a HierarchicalDataTemplate for the Item template as follows.


   <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
       <Grid.Resources>

             <HierarchicalDataTemplate x:Key="ItemTemplateTree"
                                       ItemsSource="{Binding Children}">
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Text="{Binding Name}" FontWeight="Bold" />
                     <TextBlock Text="{Binding Value, StringFormat=': {0}'}" />
                 </StackPanel>
             </HierarchicalDataTemplate>
         </Grid.Resources>
 <telerik:RadTreeView  Name="JsonTreeView"
             ItemsSource="{Binding SelectedItemInContent.MediaTreeInfoJson}"
             IsVirtualizing="True"
             SelectionMode="Extended"
             ItemTemplate="{StaticResource ItemTemplateTree}"
            />

     </Grid>




 

But if I try to change the ItemContainerStyle like in the Demo examples "ShuttleControl_WPF", the whole tree disappears.  As if it doesn't have a properly defined Style.

 


<Style x:Key="nodeStyle" TargetType="telerik:RadTreeViewItem">
       <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
   </Style>

The model I use for Items is as follows:

 


 public class JsonInfoTreeModel: ViewModelBase
    {
        private string name;
        private string value;
        private ObservableCollection<JsonInfoTreeModel> children;
        private bool isExpanded;

        public JsonInfoTreeModel()
        {
            Children = new ObservableCollection<JsonInfoTreeModel>();
            IsExpanded = true;
        }

        public string Name
        {
            get { return name; }
            set
            {
                if (name != value)
                {
                    name = value;
                    OnPropertyChanged(nameof(Name));
                }
            }
        }

        public string Value
        {
            get { return value; }
            set
            {
                if (this.value != value)
                {
                    this.value = value;
                    OnPropertyChanged(nameof(Value));
                }
            }
        }

        public ObservableCollection<JsonInfoTreeModel> Children
        {
            get { return children; }
            set
            {
                if (children != value)
                {
                    children = value;
                    OnPropertyChanged(nameof(Children));
                }
            }
        }

        public bool IsExpanded
        {
            get { return isExpanded; }
            set
            {
                if (isExpanded != value)
                {
                    isExpanded = value;
                    OnPropertyChanged(nameof(IsExpanded));
                }
            }
        }
    }


Thank you for any help.

 

 

************** Update ****************

ExamleDesk.WPF.zip

 

 

Tadeáš
Top achievements
Rank 1
 updated question on 06 Aug 2024
0 answers
86 views

Hi !

I'm using a radButton because if i use radRadioButton when i've "checked" it the background theme is green like the same unlock svg color, but i want make an exception background color when my RadRadioButton use this svg.

But my menu selection must be all radradiobutton because when one of them is selection page content (ViewModel) must change. the lock/unlock buttons are new because my project change and next access to the parts and conditioned by a validation page.

<UserControl.Resources>
<PathGeometry x:Key="UnLock" Figures="M18 1C15.24 1 13 3.24 13 6V8H4C2.9 8 2 8.89 2 10V20C2 21.11 2.9 22 4 22H16C17.11 22 18 21.11 18 20V10C18 8.9 17.11 8 16 8H15V6C15 4.34 16.34 3 18 3C19.66 3 21 4.34 21 6V8H23V6C23 3.24 20.76 1 18 1M10 13C11.1 13 12 13.89 12 15C12 16.11 11.11 17 10 17C8.9 17 8 16.11 8 15C8 13.9 8.9 13 10 13Z"/>
<PathGeometry x:Key="Lock" Figures="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"/>
</UserControl.Resources>


<Grid Grid.Column="1" Width="50" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,5">
    <telerik:RadButton Cursor="Hand" Padding="4" Command="{Binding InitValidationCommand}">
            <Viewbox Width="32" Height="32">
            <Canvas Width="24" Height="24">
                <Path>
                    <Path.Style>
                        <Style TargetType="Path">
                            <Setter Property="Data" Value="{StaticResource ResourceKey=Lock}"/>
                            <Setter Property="Fill" Value="#F44336"/>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding InitEtude.IsDeverrouille}" Value="True">
                                    <Setter Property="Data" Value="{StaticResource ResourceKey=UnLock}" />
                                    <Setter Property="Fill" Value="{telerik:Windows11Resource ResourceKey=AccentBrush}"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Path.Style>
                </Path>
            </Canvas>
        </Viewbox>
    </telerik:RadButton>
</Grid>

i've tested in other part of my project many option but to overflow theme checked definition :

- no success

<telerik:RadRadioButton Width="115" Height="50" Cursor="Hand" Margin="0,0,0,5" GroupName="test">
    <ControlTemplate TargetType="telerik:RadRadioButton">                                    
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Background" Value="Red"/>
                <Setter Property="helpers:ThemeHelper.CheckedBackgroundBrush" Value="red"/>
                <Setter Property="helpers:ThemeHelper.CheckedBrush" Value="blue"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="Red"/>
                <Setter Property="helpers:ThemeHelper.CheckedBackgroundBrush" Value="red"/>
                <Setter Property="helpers:ThemeHelper.CheckedBrush" Value="blue"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="True">
                <Setter Property="Background" Value="Red"/>
                <Setter Property="helpers:ThemeHelper.CheckedBackgroundBrush" Value="red"/>
                <Setter Property="helpers:ThemeHelper.CheckedBrush" Value="blue"/>
            </Trigger>
        </ControlTemplate.Triggers>                                    
    </ControlTemplate>
</telerik:RadRadioButton>

Vincent
Top achievements
Rank 1
Iron
Iron
 asked on 05 Aug 2024
0 answers
66 views

I want to save the expansion state of my TreeListView before I reload the data and I use the following code:


foreach (var item in _currentTreeListView.Items)
{
    if (_currentTreeListView.IsExpanded(item))
    {
        expandedItems.Add(item);
    }
}

// Data update and TreeListView reload

foreach (var item in expandedItems)
{
    _currentTreeListView.ExpandHierarchyItem(item);
}

But _currentTreeListView.IsExpanded(item) returns false no matter if the corresponding item is expanded in the TreeListView. What's the problem?

D
Top achievements
Rank 1
 asked on 02 Aug 2024
0 answers
47 views

DELETE THIS QUESTION

Juan
Top achievements
Rank 1
 updated question on 01 Aug 2024
0 answers
115 views

        <Style TargetType="telerik:TreeListViewRow">
            <Setter Property="SelectedBackground" Value="Red"/>
        </Style>

I set the SelectedBackground property, but it didn't work. I hope you can tell me what to do?

YunFan
Top achievements
Rank 1
 asked on 01 Aug 2024
1 answer
89 views

Hello,

 

I need some advice about RadAutoCompleteBox.

When I click on RadAutoCompleteBox I want to see all possible results and then I will have a option to choose whether I want to select from them or start searching by typing.  Searching for text and then selecting works fine, but unfortunately searching with nothing in it doesn't work. When I click on RadAutoCompleteBox all the results are displayed, but I can't select anything from them until I type something. The hover selection works fine, I just can't select anything if RadAutoCompleteBox.SearchText is empty. Could you help me how to solve this? Thank you very much.

I am sending part of my the source code and example (WpfApp1.zip) where it also not working.


... 
 <controls:RadAutoCompleteBoxFilter x:Key="RadAutoCompleteBoxFilter" />
...
     <telerik:RadAutoCompleteBox Grid.Row="0"
                      x:Name="CaseAutoCompleteBox"
                      WatermarkContent="{x:Static rs:ResourceText.Start_Typing}"
                      ItemsSource="{Binding Suggestions}"
                      SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                      TextSearchMode="Contains"
                      TextSearchPath="Name"
                      DisplayMemberPath="Name"
                      AutoCompleteMode="SuggestAppend"
                      DropDownItemTemplate="{StaticResource CasesSearchAutoComplete}"
                      SelectionMode="Single"
                      SelectionChanged="CaseAutoCompleteBoxSelectionChanged"
                      PreviewMouseLeftButtonDown="OnPreviewMouseLeftButtonDown"
                      GotFocus="CaseAutoCompleteBox_OnGotFocus"
                      FilteringBehavior="{StaticResource RadAutoCompleteBoxFilter}"
                    
                      />



 public partial class AddMediaToCase 
 {
     public AddMediaToCase()
     {
         InitializeComponent();
         RadWindowInteropHelper.SetShowInTaskbar(this, true);
     }

     private void CaseAutoCompleteBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
     {
         var autoCompleteBox = sender as RadAutoCompleteBox;
         CaseInformationStackPanel.Visibility = autoCompleteBox.SelectedItem != null ? Visibility.Visible : Visibility.Collapsed;
     }

     private void OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
     {

         if (string.IsNullOrWhiteSpace(CaseAutoCompleteBox.SearchText))
         {
             CaseAutoCompleteBox.Populate(" ");
             
         }


     }

     private void CaseAutoCompleteBox_OnGotFocus(object sender, RoutedEventArgs e)
     {
         if (string.IsNullOrWhiteSpace(CaseAutoCompleteBox.SearchText))
         {
             
             CaseAutoCompleteBox.Populate(" ");
         }

     }
 }


  public class RadAutoCompleteBoxFilter : FilteringBehavior
  {
      public override IEnumerable<object> FindMatchingItems(string searchText, IList items,
          IEnumerable<object> escapedItems, string textSearchPath,
          TextSearchMode textSearchMode)
      {
          var result =
              base.FindMatchingItems(searchText, items, escapedItems, textSearchPath, textSearchMode) as
                  IEnumerable<object>;

          if (string.IsNullOrEmpty(searchText) || !result.Any())
          {
              return ((IEnumerable<object>)items).Where(x => !escapedItems.Contains(x));
          }

          return result;
      }
  }


 

Martin Ivanov
Telerik team
 answered on 30 Jul 2024
1 answer
120 views

Package: Telerik.UI.for.Wpf.70, Version=2024.2.514

I include all necessary theme files for Windows 11 theme in App.xaml:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows11;component/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Windows11;component/Themes/Telerik.Windows.Controls.xaml"/>
                ...
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

I place a simple Button and RadButton inside MainWindow.xaml. When running in this configuration the buttons are visible, the correct theme is assigned. (see screenshot 1)

When placing Windows11Palette.LoadPreset(Windows11Palette.ColorVariation.Dark); inside OnStartup of Application the buttons disappear during runtime. (see screenshot 2)

What am I missing here? The same is with Fluent theme. Other themes like Office2019 work perfectly.

TIA
Heiko

Martin Ivanov
Telerik team
 answered on 30 Jul 2024
1 answer
75 views

Hi,

We are creating a table which then gets inserted into a RichTextBox. We need to add a DocumentVariableField to one of the cells, can anyone please advise.


// The field which needs to be added o the table
            
doc_text.Document.DocumentVariables.Add("1001", addrName);
DocumentVariableField docVariable = new DocumentVariableField() { VariableName = "1001"  };
           
doc_text.InsertField(docVariable, FieldDisplayMode.Result);
            

RadDocument document = new RadDocument();
Section section = new Section();

TableWidthUnit w1 = new TableWidthUnit(100);
TableWidthUnit w2 = new TableWidthUnit(520);

Table table = new Table();
table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;

TableRow row1 = new TableRow();
TableCell cell1 = new TableCell();
cell1.Background = Color.FromRgb(174, 255, 190);
cell1.PreferredWidth = w1;
cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
Paragraph p1 = new Paragraph();
Span s1 = new Span();
s1.FontWeight = FontWeights.Bold;
s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
s1.Text = "Name";
p1.Inlines.Add(s1);
cell1.Blocks.Add(p1);
row1.Cells.Add(cell1);

TableCell cell2 = new TableCell();
cell2.Background = Color.FromRgb(174, 255, 190);
cell2.PreferredWidth = w2;
cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
Paragraph p2 = new Paragraph();
Span s2 = new Span();
s2.FontWeight = FontWeights.Bold;
s2.FontFamily = new FontFamily(CGlobals.docu_default_font);
s2.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
            
s2.Text = addrName;  // We need to change this to the DocumentVariableField
p2.Inlines.Add(s2);
cell2.Blocks.Add(p2);
row1.Cells.Add(cell2);
table.Rows.Add(row1);

section.Blocks.Add(new Paragraph());
section.Blocks.Add(table);
section.Blocks.Add(new Paragraph());
document.Sections.Add(section);

doc_text.Document = document;

 

Many thanks

Dimitar
Telerik team
 answered on 26 Jul 2024
1 answer
98 views

Hi,

We are creating a table and adding it to a RichTextBox:


        public void AddAddress()
        {
            string addrName = string.Empty;
            string[] rowName = new string[] { "Job Title", "Employer", "Address", "Tel.", "Tel. Dir.", "Mobile", "Email", "Website", "Fax", "Details", "Address", "Tel.", "Mobile", "Email", "Details" };
            if(_selelement != null)
            {
                addrName = _selelement.GetAttribute("title");
            }
            SdtProperties sdtProperties = new SdtProperties(SdtType.RichText)
            {
                Alias = "AddressName",
                Lock = Lock.SdtContentLocked,
                ID = 1001,
            };
            RadDocument document = new RadDocument();
            Section section = new Section();

            TableWidthUnit w1 = new TableWidthUnit(100);
            TableWidthUnit w2 = new TableWidthUnit(520);

            Table table = new Table();
            table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;

            TableRow row1 = new TableRow();
            TableCell cell1 = new TableCell();
            cell1.Background = Color.FromRgb(174, 255, 190);
            cell1.PreferredWidth = w1;
            cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
            Paragraph p1 = new Paragraph();
            p1.Background = Color.FromRgb(174, 255, 190);
            Span s1 = new Span();
            s1.FontWeight = FontWeights.Bold;
            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
            s1.Text = "Name";
            p1.Inlines.Add(s1);
            cell1.Blocks.Add(p1);
            row1.Cells.Add(cell1);

            TableCell cell2 = new TableCell();
            cell2.Background = Color.FromRgb(174, 255, 190);
            cell2.PreferredWidth = w2;
            cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
            Paragraph p2 = new Paragraph();
            p2.Background = Color.FromRgb(174, 255, 190);
            Span s2 = new Span();
            s2.FontWeight = FontWeights.Bold;
            s2.FontFamily = new FontFamily(CGlobals.docu_default_font);
            s2.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
            s2.Text = addrName;
            p2.Inlines.Add(s2);
            cell2.Blocks.Add(p2);
            row1.Cells.Add(cell2);
            table.Rows.Add(row1);

            int rowCount = 0;
            foreach(string rname in rowName)
            {
                rowCount++;
                row1 = new TableRow();
                cell1 = new TableCell();
                p1 = new Paragraph();
                if (rowCount < 11)
                {
                    cell1.Background = Color.FromRgb(255, 229, 153);
                    p1.Background = Color.FromRgb(255, 229, 153);
                }
                else
                {
                    cell1.Background = Color.FromRgb(196, 255, 255);
                    p1.Background = Color.FromRgb(196, 255, 255);
                }
                cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                s1 = new Span();
                s1.FontWeight = FontWeights.Bold;
                s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                s1.Text = rname;
                p1.Inlines.Add(s1);
                cell1.Blocks.Add(p1);
                row1.Cells.Add(cell1);

                cell2 = new TableCell();
                cell2.Background = Color.FromRgb(255, 255, 255);
                cell2.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                p2 = new Paragraph();
                s2 = new Span();
                s2.FontFamily = new FontFamily(CGlobals.docu_default_font);
                s2.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                s2.Text = " ";
                p2.Inlines.Add(s2);
                cell2.Blocks.Add(p2);
                row1.Cells.Add(cell2);
                table.Rows.Add(row1);
            }

            section.Blocks.Add(new Paragraph());
            section.Blocks.Add(table);
            section.Blocks.Add(new Paragraph());
            document.Sections.Add(section);

            doc_text.Document = document;   
        }

How can we add a Content Control with StdProperties to one of the table cells, similar to:

SdtProperties sdtProperties = new SdtProperties(SdtType.RichText) 
{ 
    Alias = "AliasName", 
    Lock = Lock.SdtContentLocked, 
}; 
doc_text.InsertStructuredDocumentTag(sdtProperties); 

Dimitar
Telerik team
 answered on 26 Jul 2024
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?