Keboo on master
Fix submenus of top-level MenuI… (compare)
Keboo on master
Updating GitHub Action step nam… (compare)
Keboo on icons
Keboo on master
Create control_styles.yml Addi… (compare)
Keboo on master
[Icon update detected by Github… (compare)
github-actions[bot] on icons
[Icon update detected by Github… (compare)
Keboo on master
Testing icon update (compare)
Keboo on gitHubActionsIconUpdate
Keboo on master
GitHub Action for Icon Update (… (compare)
-=
operator. You can see some examples and documentation here
Hi, I am trying to make a reusable "materialDesign:DialogHost" for a Yes / No confirmation Dialog. The only thing that would change on the control are the two texts inside two TextBlock. And I want to call it from the ViewModel and get the Yes / No result.
I followed the example called "DialogHost.WithResult" but it uses
<materialDesign:DialogHost.DialogContentTemplate>
<DataTemplate DataType="system:String">
<StackPanel Margin="20">
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</materialDesign:DialogHost.DialogContentTemplate>
wich allow to pass only one string from the ViewModel.
So is it possible instead to make a reussable DialogHost and instead of setting the DialogContentTemplate with a string we pass two strings directly to DialogContent ?
@AmraniRiyad Hi! You can create your own user control. For example
Code-behind:
var myUserControl = new MyUserControl("myFirstString", "mySecondString");
var result = await MaterialDesignThemes.Wpf.DialogHost.Show(myUserControl);
Custom user control's textblocks should binds to those strings.
<TextBlock Text="{Binding Text1, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MyUserControl}}"/>
<TextBlock Text="{Binding Text2, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MyUserControl}}"/>
In MyUserControl view (xaml.cs):
public string Text1 { get; }
public string Text2 { get; }
In main window just remove data content template.
<DataTemplate DataType="{x:Type toolsViewModels:ConfirmationDialogHostViewModel}">
<controls:ConfirmationDialogHost HeaderText="{Binding HeaderText}" Text="{Binding Text}" />
</DataTemplate>
Hello, im trying to override the default style of buttons but no matter what I put in MaterialDesignThemes.Overrides.xaml
it does not change anything. Just for testing I have:
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignRaisedButton}">
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontSize" Value="26" />
</Style>
I also tried overriding other controls but nothing changes. The only thing I got to work is the example from github wiki:
<Style BasedOn="{StaticResource MaterialDesignButtonTextBlock}" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="24" />
</Style>
Any ideas why nothing works but the TextBlock? Im also using MahApps if that changes anything.
Hey guys, can someone help me with this issue MaterialDesignInXAML/MaterialDesignInXamlToolkit#2211 ? I assume it is a problem that can solve also the DrawerHost
problem if there is DataGrid
inside @Erapchu.
I tried to measure content in DialogHost
and then setting the Height
and Width
of _popupContentControl
I also tried to disable the animation but it still does not resolve the issue, showing the dialog is slow if the DialogContent
changes.
Note: I am using the MaterialDesignEmbeddedDialogHost
style
<Style TargetType="{x:Type Button}" x:Key="MaterialDesignRaisedOversizedFontButton" BasedOn="{StaticResource MaterialDesignRaisedButton}">
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontSize" Value="24" />
</Style>
<Button Style="{StaticResource MaterialDesignRaisedOversizedFontButton}">
<TextBlock Text="ABC"/>
</Button>
@stany9g Hi! I can replicate you issue. It's because UI thread try to redraw all rows and columns controls inside DataGrid.
My case was when i try to show left dialog panel over the datagrid, but not the datagrid inside dialog content. When you re-set your UserControl (even if it was initialized) in dialog host, this control redraw what you past in it. Redraw all rows is a costly operation for datagrid with 1000 rows even if this control is virtualized. You can try to implement this collection if applicable for data grid (for listview or listbox i think yes):
https://www.codeproject.com/Articles/34405/WPF-Data-Virtualization
And you can check that UI thread just draw each row and it's costly operation with Material designed DataGrid.
Try to disable material styles for each sub-elements by merging this resources:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme
BaseTheme="Light"
PrimaryColor="DeepPurple"
SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DialogHost.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
DialogHost.xaml only in your demo app. After that try to open first, then second dialog with datagrids. It should be a little bit faster with default styles.
DataGrid
. For now, I have set the MaxWidth
and MaxHeight
of the underlying PART_PopupContentElement
(Card
) in the style and removed the VisualTransition
with that I reached a quite the "optimization" still not perfect as a just opening the same dialog as when switching between content
of dialog. Anyway, thank you for the help I really appreciate your time and effort.
<!--In Defaults.xaml-->
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MyStyledButton}" />
<!--Your style-->
<Style x:Key="MyStyledButton" TargetType="{x:Type ButtonBase}">
</Style>
<!--In app.xaml, merged dictionaries-->
<ResourceDictionary Source="pack://application:,,,/WpfApp1;component/ResourceDictionaries/Defaults.xaml"/>
Exception thrown: 'System.Runtime.InteropServices.COMException' in PresentationCore.dll
Exception thrown: 'System.NotImplementedException' in PresentationCore.dll
public class SelectableViewModel : INotifyPropertyChanged
{
private bool _isSelected;
private string _name;
private string _description;
private AnotherCommandImplementation CopyToClipboardCommands;
public ICommand CopyToClipboards => CopyToClipboardCommands = new AnotherCommandImplementation(CopyToClipboard);
private void CopyToClipboard(object obj)
{
var toBeCopied = obj;
try
{
if (toBeCopied != null)
{
Clipboard.SetDataObject(toBeCopied);
}
}
catch
{
Console.WriteLine("Clipbaord error");
}
}